- 9
- Posts
- 13
- Years
- Toronto, Canada
- Seen Apr 16, 2015
This isn't so much a tutorial as a "what I did to make this work" thread. I probably did it all wrong, but I'm open to people telling me how to make it better. I made it for a fan-game I'm making called Pokémon Ocean Blue (more details on that later), but I figured there might be more people out there who would be able to use this feature.
Before I began, I compiled a list of things I needed:
- 6 department store maps (1 for each floor).
- 1 map for the elevator interior.
- A game variable to keep track of which floor the player is on.
First, I added a new Game Variable called "Elevator_Floor" in slot [0007]. This is important, as I call for "$game_variables[0007]" in the following scripts.
Second, I added a new script section called Pokemon Elevator so I could easily refer back to the code. Within it, I added the following code:
Basically, this code just displays a window indicating the current floor of the player.
Third, on each floor of the department store, I added events to transfer the player from the current map to the elevator map, but added a line:
*Where X is the floor number.
This way, the game keeps track of the current floor of the player.
Next, I added an event at the exit door of the Elevator map containing 6 pages - one for each floor. Under conditions, I listed the variable "[0007:Elevator_Floor] is X or above" where X is the floor number. So, on the first event page, it looks like "[0007:Elevator_Floor] is 1 or above", etc.
The actual commands are the exact same as normal map transfers, just the map the player is transferred to matches the event page. So, the first event page lists commands that transfers players to the first floor, etc.
Lastly, and most importantly, I implemented the panel that lets the player select which floor to travel to. It is a single-page event that looks like this:
It's pretty self-explanatory, but basically, it starts the pbElevator script created earlier, then displays choices corresponding to the floors. The player selects an option and the game sets the Elevator_Floor variable to the corresponding number, shakes the screen, plays a chime, then removes the floor indicator using the pbHideElevator script from earlier.
There we go! The elevator is now fully-functioning and ready to transport you to a shopping destination of your choice.
-f42
Before I began, I compiled a list of things I needed:
- 6 department store maps (1 for each floor).
- 1 map for the elevator interior.
- A game variable to keep track of which floor the player is on.
First, I added a new Game Variable called "Elevator_Floor" in slot [0007]. This is important, as I call for "$game_variables[0007]" in the following scripts.
Second, I added a new script section called Pokemon Elevator so I could easily refer back to the code. Within it, I added the following code:
Spoiler:
Code:
def pbElevator
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["elewindow"]=Window_UnformattedTextPokemon.new("")
@sprites["elewindow"].x=Graphics.width-160
@sprites["elewindow"].y=0
@sprites["elewindow"].width=160
@sprites["elewindow"].height=96
@sprites["elewindow"].text=_INTL("Current Floor: {1}",$game_variables[0007])
end
def pbHideElevator
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
Basically, this code just displays a window indicating the current floor of the player.
Third, on each floor of the department store, I added events to transfer the player from the current map to the elevator map, but added a line:
Code:
@> Control Variables:[0007:Elevator_Floor] = X
This way, the game keeps track of the current floor of the player.
Next, I added an event at the exit door of the Elevator map containing 6 pages - one for each floor. Under conditions, I listed the variable "[0007:Elevator_Floor] is X or above" where X is the floor number. So, on the first event page, it looks like "[0007:Elevator_Floor] is 1 or above", etc.
The actual commands are the exact same as normal map transfers, just the map the player is transferred to matches the event page. So, the first event page lists commands that transfers players to the first floor, etc.
Lastly, and most importantly, I implemented the panel that lets the player select which floor to travel to. It is a single-page event that looks like this:
Spoiler:
Code:
@>Text: Which Floor?
@>Script: pbElevator
@>Show Choices: 1, 2, 3, Next
: When [X] (i.e. numbers 1-3)
@>Screen Shake: 1, 9, @20
@>Wait:20 frame(s)
@>Play SE: 'accesspc',80,90
@>Control Variables:[0007:Elevator_Floor] = X
@>Wait:5 frame(s)
@>Script: pbHideElevator
@>
...
: When [Next]
@>Show Choices: 4, 5, 6, Cancel
: When [Y] (i.e. numbers 4-6)
@>Screen Shake: 1, 9, @20
@>Wait:20 frame(s)
@>Play SE: 'accesspc',80,90
@>Control Variables:[0007:Elevator_Floor] = Y
@>Wait:5 frame(s)
@>Script: pbHideElevator
@>
...
: When [Cancel]
@>Script: pbHideElevator
@>
: Branch End
@>
: Branch End
@>
It's pretty self-explanatory, but basically, it starts the pbElevator script created earlier, then displays choices corresponding to the floors. The player selects an option and the game sets the Elevator_Floor variable to the corresponding number, shakes the screen, plays a chime, then removes the floor indicator using the pbHideElevator script from earlier.
There we go! The elevator is now fully-functioning and ready to transport you to a shopping destination of your choice.
-f42