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,649
Reaction score
15,281
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,649
Reaction score
15,281
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,649
Reaction score
15,281
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

 …So I was looking at a question someone had asked and did some related experimentation. Apparently the Jump… movement route command works like the ultimate through. Including letting you move around outside the confines of the map entirely. o_O
Jump.png
Okay so today I heard the dumbest theory I have heard in a loooooooong while. It's so stupid I just have to share... Appearantly I have learned to draw 'hot chicks' so that 'real men' get physically excited by looking at it and I can then swoop in and 'turn' them.... Wow... Just... Amazing how some brains works...
What the writer wrote: "The curtain is blue."
The readers: "There must be a hidden meaning behind this, perhaps to convey the character emotions ...".
What the writer has in mind: "The curtain is frickin' blue".
Time to share something!
hmZFwQe.png

I made these a while ago for my game. I took reference from various huts in Africa.
Have a great night! :D
I really need to buy a new mouse. Mine's keeps double-clicking and makes me waste A LOT of time eventing

Forum statistics

Threads
115,843
Messages
1,093,362
Members
151,034
Latest member
Jubs
Top