thoromyr

Villager
Member
Joined
Nov 6, 2015
Messages
5
Reaction score
0
First Language
English
I don't see any built in way to restrict an event's movement to a region or regions. The logic to implement this via script is trivial, but I'm having trouble with the specific details. For example, I see that events have properties of x and y, but I haven't located how to query the map with those values. Nor am I sure how I would refer to the event in the script.

If there's a built in way to do this, that's great -- I'd like to know how to do it. If there isn't, I could use some pointers on the scripting (the programming itself isn't a problem, its the specifics of the API).
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,761
Reaction score
15,319
First Language
English
Primarily Uses
RMMV
There is not a built-in way, but there are already plugins that will allow you to do this.
 

thoromyr

Villager
Member
Joined
Nov 6, 2015
Messages
5
Reaction score
0
First Language
English
any hints as to the plugins?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,761
Reaction score
15,319
First Language
English
Primarily Uses
RMMV
I would have to search for it. And I'm sure you can do that just as well as I can ;)
 

thoromyr

Villager
Member
Joined
Nov 6, 2015
Messages
5
Reaction score
0
First Language
English
so you are saying that there's a plugin, somewhere, that does this, but you don't know where it might be? If you didn't know anything you didn't have to post.

Does anyone know where I might find some API documentation that is more useful than what is provided? Or at least some practical examples of scripts interacting with events?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,761
Reaction score
15,319
First Language
English
Primarily Uses
RMMV
wow - I'm sorry I told you there was already a plugin out there that will already do this for you. I should have just let you sit waiting, instead of letting you know that you might find it if you searched for it.


My time is just as valuable as yours - why should I spend it searching for something I'm not going to use, when you're the one who needs it, and I'm sure are just as capable as looking for it as I am?


Look for Yanfly's plugins.
 

thoromyr

Villager
Member
Joined
Nov 6, 2015
Messages
5
Reaction score
0
First Language
English
Hey, I appreciate all the kind words and support. It feels really good to have such caring. I'll be sure in the future to not ask questions that no one likes answering. Thanks!
 

thoromyr

Villager
Member
Joined
Nov 6, 2015
Messages
5
Reaction score
0
First Language
English
To at least partially address the question, some pointers are the functions:

Game_CharacterBase.prototype.canPass()

Game_CharacterBase.prototype.canPassDiagonally()

Game_CharacterBase.prototype.isMapPassable()

These are in rpg_objects.js. The parameter 'd' is for 'direction' which, in keeping with the rest of the code, isn't documented but is expected to be an integer where:

2: y+1

4: x+1

6: x-1

8: y-1

Due to the apparent architecture, it would appear difficult to avoid having border movement result in fewer actual moves. Without documentation its a matter of unraveling clean but undocumented code so I could be wrong, but it appears that the model employed is to attempt to move then reject impossible moves without moving. So if an event has ended up on a tile that is blocked in three directions it will sit there until it happens to select the one direction that is not blocked.
 

RyokuHasu

Developer
Veteran
Joined
Jun 23, 2012
Messages
274
Reaction score
38
First Language
English
Primarily Uses
a Simple option would be get the X and Y of the event and compare it to set a max X, max Y, minimum X, and Minimum Y and if the event steps on those boundaries it automatically turns around back into it's area.

It's a bit intensive if you use this for a lot of events but it's a somewhat simple way to do it without scripting.

I used a similar regional checking event for if the player entered a snowy region and then dynamically changed the weather when the line was crossed

one of the downsides is that the set areas are limited to 4 sided boxes with little room for custom shape without bogging it down with more events.

Edit: I have attached a quick example of how to get the NPC events to move in a set region with only eventing.

Important Note, the event is set to parallel and has a small wait timer so it won't freeze the game.

The event moves at random just fine within the specified area and really unless you stare at it for a while or have it set of really fast movement then you shouldn't notice the exact boundaries in game.

Edit 2: I noticed that if i have party members and they follow on the map you can trap the event in the corner of it's area, not a bug, just was fun to do.

NPC Zoning Example.png
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

I'm gonna put my project on pause for a tiny bit so I can explore the engine outside of it... Winging it can only get you so far LMFAO
Have seen some of my favorite people here posting and helping others with questions today -- love to see it!
Haven't been on here actively in awhile, project is going strong my biggest issue is the STORY, i'm refining the plot and learning so much i decided to take a writers class to improve even more but the programming and functionality of the game is stepping up nicely!
Hi everyone! Here's what I'm working on today! It's one of the dorms on campus. I know I said I wouldn't use assets but I reused a few things from the cafeteria hehe.
FCuxBOMXMAICK5e
I added a little squish effect when characters change direction to try and make things a bit more lively. Though it's a bit hard to see on the fast moving guys.
2f4fiuy.gif

Forum statistics

Threads
116,126
Messages
1,095,984
Members
151,537
Latest member
Anrirck
Top