Window Displaying Tile Contents

Camkitsune

Veteran
Veteran
Joined
Mar 9, 2017
Messages
34
Reaction score
4
First Language
English
Primarily Uses
RMMV
As part of the strategy engine I'm developing, I want to have a small window in the lower left corner that displays information on the tile the player's is currently standing on. I'd also like it to display soldier counts and a few other bits of relevant information when an event with the appropriate flags is under the player position.

There are two things I'm not clear on:
1) How would I go about putting a window into Scene_Map that would still allow the player to move around (like in Yanfly's Gab plugin)?
Would I specifically have to create the window during Scene_map.initialize and have it hidden except under the desired circumstances?
2) How do I Get a particular event's data based on its X/Y coordinates?
Getting the info from the event I understand; the major point of confusion is getting the Event itself so that I can do things like check for whether or not it has the relevant data.
 

Clock Out

Veteran
Veteran
Joined
Jun 14, 2016
Messages
92
Reaction score
45
First Language
English
Primarily Uses
RMMV
Scenes are handles by the SceneManager object and the current scene is assigned to the _scene property. Initialized windows can be pushed onto the current scene using scene's addWindow() method.

Say we had a function that returns a new window.
Code:
function aWindow(x, y) {
    "use strict";

    var win = Object.create(Window_Base.prototype);
    var width = 300;
    var height = 200;

    win.constructor = aWindow;

    win.initialize(x, y, width, height);

    return win;
}
The window can be added to the running scene anytime.
Code:
SceneManager._scene.addWindow(aWindow());
The addWindow() method pushes the window onto the scene's _windowLayer.children array. If you want to see what windows are attached to a scene then inspect the children property.
Code:
SceneManager._scene._windowLayer.children;
It's up to you on whether you want to add the window using the scene's initialize method or if you want to do it later on. Call the window's open() or close() methods to make it appear or vanish as needed.

Events on the map can be found using the $gameMap object. Kino hosts an RPGMakerMV Library which is really handy for looking up properties and methods of game objects. For example $gameMap.eventsXy() returns the event at the specified x and y coordinates on the map. More can be found under Game_Map. If the player is standing on an event then it's possible to get the event by passing in the x and y properties of $gamePlayer.
Code:
$gameMap.eventsXy($gamePlayer.x, $gamePlayer.y);
 

WickedWolfy

Touch Fluffy Tail!
Veteran
Joined
Nov 27, 2017
Messages
115
Reaction score
50
First Language
En
Primarily Uses
RMMZ
I'd like to suggest this video tutorial Helped me out with starting on Windows with MV.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top