The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Diploma (and how to do a simple scene)

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.

Thread Tools
Old August 14th, 2012 (5:58 AM).
FL's Avatar
FL FL is online now
Pokémon Island Creator
    Join Date: Sep 2010
    Gender: Male
    Posts: 1,722
    # * Diploma - by FL (Credits will be apreciated)
    # This script is for Pokémon Essentials. It displays a game diploma like in
    # official games. This is a very simple scene that I made in a way with several
    # comments that can be used as a guide to make simple scenes in Essentials.
    # To this script works, put it above main. To show the diploma use 
    # 'pbDiploma(maintext,imagepath)' where the maintext is the diploma maintext
    # and the imagepath is the path of the diploma picture (like 
    # "Graphics/Pictures/diploma"). If you call it without parameters (only
    # 'pbDiploma') then the default main text and image path are used. 
    # I suggest to call this script only when the condition 
    # '$Trainer.pokedexOwned==PBSpecies.maxValue' is true.
    class DiplomaScene # The scene class
      def update
        # Updates all sprites in @sprites variable
      def pbStartScene(maintext,imagepath)
        # Initialize the sprite hash where all sprites are. This is better for
        # calling methods for all sprites once like pbUpdateSpriteHash
        # Creates a viewpoint with z=99999, so you can see all sprites with 
        # z below 99999. The higher z sprites are above the lower ones.,0,Graphics.width,Graphics.height)
        # Creates a new IconSprite object and sets its bitmap to imagepath
        # A little trick to centralize if the background hasn't the screen size
        @sprites["background"].x=([email protected]["background"].bitmap.width)/2
        @sprites["background"].y=([email protected]["background"].bitmap.height)/2
        # Creates an overlay to write text over it
        # Set the font defined in "options" on overlay
        # Calls the pbDrawText method
        # After everything is set, show the sprites with "FadeIn" effect.
        pbFadeInAndShow(@sprites) { update }
      def pbDrawText(maintext)
        [email protected]["overlay"].bitmap
        # Clear the overlay to write text over it. In this script the clear is
        # useless, but if you want to change the text without remake the overlay,
        # then this is necessary.
        # I am using the _INTL for better others parameters (like $
        # manipulation and to allow text translation (made in PBIntl script section) 
        playerName=_INTL("Player: {1}",$
        # The margins sizes for each side
        # Creates a new color for text baseColor and text shadowColor.
        # The three numbers are in RGB format.,72,72),160,160)
        # Creates an array with pbDrawTextPositions second parameter. Search for
        # 'def pbDrawTextPositions' to understand the second parameter.
        # 'Graphics.width-value' and 'Graphics.height-value' make the value counts
        # for the reverse side. This is also useful for different screen size 
        # graphics. Ex: Graphics.height-96 its the same than 288 if the 
        # graphics height is 384.
        # 'Graphics.width/2' and 'Graphics.height/2' returns the center point. 
           [_INTL("Game Freak"),Graphics.width-marginRight,Graphics.height-64,1,baseColor,shadowColor]
        # Draw these text on overlay.
        # Using drawTextEx (search for 'def drawTextEx' to understand the
        # parameters) to make a line wrap text for main text.
      def pbMain
        loop do
          # Updates the graphics
          # Updates the button input check
          # Calls the update method on this class (look at 'def update' in
          # this class)
          # If button C or button B (trigger by keys C and X) is pressed, then
          # exits from loop and from pbMain, starts pbEndScene (look at 
          # 'def pbStartScreen')
          if Input.trigger?(Input::B) || Input.trigger?(Input::C)
            # To play the Decision SE (defined in database) when the diploma is
            # canceled, then uncomment the below line.
          # If you wish to switch between two texts when the C button is 
          # pressed (with a method like pbDrawText2), then deletes the 
          # '|| Input.trigger?(Input::C)'. Before the 'loop do' put 'actualText=1',
          # then use something like:      
          #  if(actualText==1)
          #    actualText=2
          #    pbDrawText2
          #  elsif(actualText==2)
          #    actualText=1
          #    pbDrawText
          #  end  
      def pbEndScene
        # Hide all sprites with "FadeOut" effect
        pbFadeOutAndHide(@sprites) { update }
        # Remove all sprites
        # Remove the viewpoint
    class Diploma # The screen class
      def initialize(scene)
      def pbStartScreen(maintext,imagepath)
        # Put the method order in scene. The pbMain have the scene main loop 
        # that only closes the scene when the loop breaks.
    # Here a def for a quick script call. 
    # If you don't put some parameter, then it uses default values.
    def pbDiploma(maintext="",imagepath="")
      # Picks default text if maintext==""
      maintext=_INTL("This document is issued in recognition of your magnificent achievement - the completion of the National Pokédex.") if maintext==""
      # Picks default image path if imagepath==""
      imagepath="Graphics/Pictures/diploma" if imagepath==""
    Attached Thumbnails
    diplomascreen.png‎   diploma.png‎  
    Reply With Quote

    Relevant Advertising!

    Old August 27th, 2012 (3:45 PM).
    P0kemonMast P0kemonMast is offline
      Join Date: Jun 2012
      Gender: Male
      Posts: 23
      Great looking forward to using this in some way in my game thanks again ^.^
      Reply With Quote
      Old December 3rd, 2013 (11:11 AM).
      G-Master's Avatar
      G-Master G-Master is offline
      Lead of Pokémon Roll
        Join Date: Dec 2013
        Location: AZ
        Gender: Male
        Nature: Docile
        Posts: 58
        Thanks for the detailed comments, really helped me understand scenes better.
        Reply With Quote

        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 12:19 AM.