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,682
Reaction score
15,293
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,682
Reaction score
15,293
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,682
Reaction score
15,293
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 typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!
Creating 3D CGs for Cutscenes. :kaosalute:

I keep wanting to post every song I make for the game and have to hold back on that because at this rate, I'll have spoiled all the really good stuff lol..

Forum statistics

Threads
115,903
Messages
1,093,848
Members
151,155
Latest member
PopeUrban
Top