Time to fill our door contents with something and that something is going to be our popup window.
There are few things we need to achieve that:
- Two variables to store player map X and Y coordinates (of course if the player moves we want our popup window to disappear...we don't want it to stay there forever, right?)
- A switch to tell the game that our popup window is being shown and to pass that information to other events
- A variable to create our popup window and access it from other events.
The first point is easy to achieve. Add new event command and select "Control Variables" then select a variable and
set it to be equal to Game Data > Player Map X.
If you have never stored player coordinates into a variable before nor used Game Data in your Control Variables command your game data window should look like this:
The final look of your Control Variable command should be this one:
Now you have to do the same with another variable where we are going to store player's map Y.
After setting up our variables let's add another Event Command to turn on a switch. Up to you which switch you want to use, just remember it's ID. The same goes for your variables as well.
Note: In this tutorial I am going to use Variable 1 for player X and Variable 2 for player Y while my switch will be switch number 1.
To complete this part add a Script Call event command (you can find it in the 3rd page). Script calls are really versatile and allow you to write pieces of code to be executed in your event. In our script call we need another variable to store our window. In my example it will be variable 3. To create a window we need something like this:
@shop_name = "Your Shop Name"
$game_variables[3] = Window_Base.new(0, 0, Graphics.width, 48)
$game_variables[3].draw_text_ex(0, 0, @shop_name)
Where "Your Shop Name" can be anything you want but don't forget the quotation marks!
Example: "The Happy Unicorn"
IMPORTANT: if you want to use a different variable just change the "3" in the code with your variable ID. Don't forget to do it or it will use your variable 3.
If you did everything right your event first page should look like this: