• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Starting Map Selector

Starting Map Selector 1

Pokémon Essentials Version
v18.1 ➖
This is the first time I ever create a script so I´m very excited.

This script allows the player to choose a starting map for his/her journey, I think it´s a good idea to add it in an open world game.
sla.png


sla2.png


To use the script its simple, just paste the script in and call pbMapSelector to start it.

The script it highly modifiable, you can use how many maps you would like.

I don´t know if it works with v19, cause it doesn´t run in my computer so I couldn´t test it (If you ever test it please tell me)

Also, I tried to add some animation to the arrows when a button is not pressed but I don´t know how to do it, without making the whole scene wait forever until the player can choose which map he/she wants to play.

Map Selector:
Expand Collapse Copy
PluginManager.register({

  :name => "Starting Map Selector",

  :version => "1.0",

  :credits => ["barretoareias"],

  :link => "https://reliccastle.com/resources/491/"

})



#MAP FOLDER

SELECTOR_FOLDER = "MapSelector/"

MAP_SELECTOR = SELECTOR_FOLDER+"selector.png"



#MAP CHOOSEN VARIABLE

MAP_CHOOSEN_VARIABLE = 26



#ARRAY WITH FILE NAMES

MAPS_ARRAY = {

  0 => "Kanto",

  1 => "Johto"

}

#Class

class MapSelectorScene



  #Start

  def pbStartScene

    @sprites={}

    @viewport=Viewport.new(0,0,Graphics.width,SCREEN_HEIGHT)

    @viewport.z=99999

    @select=-1

    @finished=false

    @mapNumber=0



    #Selector start

    @sprites["selector"] = Sprite.new(@viewport)

    @sprites["selector"].bitmap = RPG::Cache.picture(MAP_SELECTOR)

    @sprites["selector"].x = 0

    @sprites["selector"].y = 0

    @sprites["selector"].z = 0

    @sprites["selector"].opacity = 0



    #Map

    @sprites["map"] = Sprite.new(@viewport)

    @sprites["map"].bitmap = RPG::Cache.picture(SELECTOR_FOLDER+MAPS_ARRAY[0])

    @sprites["map"].x = 100

    @sprites["map"].y = 21

    @sprites["map"].z = 1

    @sprites["map"].opacity = 0



    #left arrow

    @sprites["left"] = Sprite.new(@viewport)

    @sprites["left"].bitmap = RPG::Cache.picture(SELECTOR_FOLDER+"left.png")

    @sprites["left"].x = 25

    @sprites["left"].y = 30

    @sprites["left"].z = 1

    @sprites["left"].opacity = 0



    #right arrow

    @sprites["right"] = Sprite.new(@viewport)

    @sprites["right"].bitmap = RPG::Cache.picture(SELECTOR_FOLDER+"right.png")

    @sprites["right"].x = 436

    @sprites["right"].y = 30

    @sprites["right"].z = 1

    @sprites["right"].opacity = 0

  end



  #Update

  def pbUpdate

    pbShow

    pbMessage("Where are you from?")

    loop do

        Graphics.update

        Input.update

        if Input.trigger?(Input::LEFT)

          pbChoose(0)

        elsif Input.trigger?(Input::RIGHT)

          pbChoose(1)

        end

  

        if Input.trigger?(Input::ENTER)

          mapSelected

        end

      break if @finished

    end

  end



  def mapSelected

    choosen = pbConfirmMessage("Are you from "+MAPS_ARRAY[@mapNumber]+"?")

    if choosen

      $game_variables[MAP_CHOOSEN_VARIABLE] = @mapNumber

      pbClose

      @finished = true

    end

  end



  def pbClose

    10.times do

      Graphics.update

      @sprites["selector"].opacity-=25.5

      @sprites["left"].opacity-=25.5

      @sprites["right"].opacity-=25.5

      @sprites["map"].opacity-=25.5

    end

  end



  def pbChoose(side)

    if(side==1) #right

      @sprites["right"].x+=15

      @mapNumber+=1

      if(@mapNumber>(MAPS_ARRAY.size-1))

        @mapNumber=0

      end

    else        #left

      @sprites["left"].x-=15

      @mapNumber-=1

      if(@mapNumber<0)

        @mapNumber=(MAPS_ARRAY.size-1)

      end

    end

    mapOff

    @sprites["map"] = Sprite.new(@viewport)

    @sprites["map"].bitmap = RPG::Cache.picture(SELECTOR_FOLDER+MAPS_ARRAY[@mapNumber])

    @sprites["map"].x = 100

    @sprites["map"].y = 21

    @sprites["map"].z = 1

    @sprites["map"].opacity = 0

    mapOn

    @sprites["left"].x = 25

    @sprites["right"].x = 436

  end



  def mapOff

    20.times do

      Graphics.update

      @sprites["map"].opacity-=25.5

    end

  end



  def mapOn

    20.times do

      Graphics.update

      @sprites["map"].opacity+=25.5

    end

  end



  def pbShow

    10.times do

      Graphics.update

      @sprites["selector"].opacity+=25.5

      @sprites["left"].opacity+=25.5

      @sprites["right"].opacity+=25.5

      @sprites["map"].opacity+=25.5

    end

  end



  #End

  def pbEndScene

    pbDisposeSpriteHash(@sprites)

    @viewport.dispose

  end



end



#Caller

class MapSelector



  def initialize(scene)

    @scene=scene

  end



  def pbStartScreen

    @scene.pbStartScene

    @scene.pbUpdate

    @scene.pbEndScene

  end



end



def pbMapSelector

  scene=MapSelectorScene.new

  screen=MapSelector.new(scene)

  screen.pbStartScreen

end
Credits
barretoareias, DeepBlue
Author
barretoareias
Downloads
469
Views
2,276
First release
Last update

Ratings

0.00 star(s) 0 ratings
Back
Top