Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old February 28th, 2012 (11:43 PM).
ferriswheel42's Avatar
ferriswheel42 ferriswheel42 is offline
     
    Join Date: Jan 2012
    Location: Toronto, Canada
    Age: 27
    Gender: Male
    Nature: Modest
    Posts: 9
    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:
    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
    *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:

    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
    __________________

    Sometimes the mind, for reasons we don't necessarily understand, just decides to go to the store for a quart of milk.
    -Diane Frolov and Andrew Schneider
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 12th, 2014 (7:00 PM).
    Schneiderism Schneiderism is offline
       
      Join Date: Jun 2014
      Gender: Male
      Posts: 2
      Where in RPG Maker XP is "Game Variables"? Everything else is very well written! Thank you for this!
      Reply With Quote
        #3    
      Old December 12th, 2014 (8:09 PM).
      Florio's Avatar
      Florio Florio is offline
      Pokemon Crimson Skies Owner
         
        Join Date: Nov 2008
        Location: Canada
        Gender: Male
        Nature: Lax
        Posts: 390
        This is honestly really simple, and I think most people should be able to figure this out on their own. Mine is almost the same, except it doesn't tell you which floor you are on. I also made it so mine tells you that you are already on that floor if you picked the one you are already on.
        __________________
        Reply With Quote
          #4    
        Old December 13th, 2014 (6:01 AM).
        Maruno's Avatar
        Maruno Maruno is offline
        Lead Dev of Pokémon Essentials
           
          Join Date: Jan 2008
          Location: England
          Posts: 5,185
          There's an example of how to make a multi-floor elevator that comes with Essentials. It's in the Cedolan Department Store.
          __________________
          Go to the Pokémon Essentials Wiki

          | Downloads | Tutorials | Fangames |
          | All Animations Project |

          Follow me on Twitter: @maruno42


          Reply With Quote
            #5    
          Old December 13th, 2014 (11:25 AM).
          Schneiderism Schneiderism is offline
             
            Join Date: Jun 2014
            Gender: Male
            Posts: 2
            Quote:
            Originally Posted by Maruno View Post
            There's an example of how to make a multi-floor elevator that comes with Essentials. It's in the Cedolan Department Store.
            So I got the elevator script, but I'm a bit confused on how the "button panel" script works. I changed what floors the prompt offers, but I don't understand how to change where the elevator actually goes. I want "F2", "F1", and "B1", so I changed the script for what it says when triggered. How do I set it up so B1 actually goes to B1, and so on?
            Reply With Quote
            Reply

            Quick Reply

            Join the conversation!

            Create an account to post a reply in this thread, participate in other discussions, and more!

            Create a PokéCommunity Account

            Sponsored Links
            Thread Tools

            Posting Rules
            You may not post new threads
            You may not post replies
            You may not post attachments
            You may not edit your posts

            BB code is On
            Smilies are On
            [IMG] code is On
            HTML code is Off

            Forum Jump


            All times are GMT -8. The time now is 2:01 PM.