[X-NP] APSCreator 2.0

    Compartilhe
    avatar
    jiraya
    Administrador
    Administrador

    Mensagens : 1299
    Credibilidade : 54

    [X-NP] APSCreator 2.0

    Mensagem por jiraya em Sab Jan 29, 2011 1:06 pm

    [Autor: SnakeDeath ]
    Scene APSCreator
    Versão: 2.0
    Por Shocks(SnakeDeath)
    Versão Original por AndersonPorto



    Características




    Script que permite a criação de personagens com mudança de classe, gráfico e inserção do nome.




    Novos Recursos





    Adição do módulo de configuração, incluindo:

    -Alteração dos textos das escolhas.
    -Número máximo de caracteres do nome.
    -Ativação ou desativação do uso de letras maiusculas ou caracteres especiais.
    -Outros



    Intruções




    Copie o script postado abaixo e substitua pelo seu.
    Imagem de Exemplo:
    [Você precisa estar registrado e conectado para ver esta imagem.]




    Download




    Script:
    Código:
    #==============================================================================
    # Scene_APSCreator [X-RGSS]
    # Author Anderson Porto
    # Version 1.0
    # Date 15-01-09
    #------------------------------------------------------------------
    # ** Version 2.0
    # by Shocks(SnakeDeath)
    #==============================================================================
    module APS_Creator

    #--------------------------------------------------------------------------
    # Prefixo do nome digitado (ex: "Nome: Shocks").
    NOME = "Nome"
    #--------------------------------------------------------------------------

    #--------------------------------------------------------------------------
    # Prefixo da classe escolhida (ex: "Classe: Aventureiro").
    CLASSE = "Classe"
    #--------------------------------------------------------------------------

    #--------------------------------------------------------------------------
    # Palavra que representa a confirmação (ex: "OK/Aceitar")
    CONFIRMAR = "Aceitar"
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    # Número máximo de caracteres do nome.
    MAX_CARACTERES = 12
    #--------------------------------------------------------------------------

    #--------------------------------------------------------------------------
    # Permitir ou proibir caracteres especiais (ex: "@,$").
    # Coloque true para ativar e false para desativar.
    ESPECIAL_CARACTERES = true
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    # Permitir ou proibir letras maiusculas.
    # Coloque true para ativar e false para desativar.
    MAIUSCULAS = false
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------
    # Coloração da janela após ultrapassar o limite de caracteres.
    # Color.new(Vermelho,Verde,Azul)
    COR_MAX = Color.new(255, 150, 150)
    #--------------------------------------------------------------------------
    end
    class Scene_APSCreator
    #--------------------------------------------------------------------------
    # * Main - Handles drawing/disposing windows and the main loop
    #--------------------------------------------------------------------------
    def main
    @data = [User_Edit::STARTER_CLASSES[0],""]
    @ims = User_Edit::CLASSES_IM
    if $online
    Network::Main.socket.send("'req'\n")
    Network::Main.socket.send("'req'\n")
    Network::Main.socket.send("'req'\n")
    Network::Main.socket.send("'req'\n")
    Network::Main.socket.send("'req'\n")
    end
    @text = []
    @ind = 0
    #Draw Windows
    main_draw
    #Execute transition
    Graphics.transition
    #Main Loop
    loop do
    #Main Loop
    main_loop
    break if main_scenechange?
    end
    #Prepare for transition
    Graphics.freeze
    #Dispose Windows
    main_dispose
    end
    #--------------------------------------------------------------------------
    # * Main Draw - Handles drawing windows
    #--------------------------------------------------------------------------
    def main_draw
    @background = Sprite.new
    @background.bitmap = RPG::Cache.title(User_Edit::CREATOR_BACK)
    @classSprite = Sprite.new
    @classSprite.bitmap = RPG::Cache.picture(@ims[0])
    @window = Creator_Name_Window.new
    @classes = User_Edit::STARTER_CLASSES
    n = []
    for i in [email=0..@classes.size-1]0..@classes.size-1[/email]
    n.push($data_classes[@classes[i]].name)
    end
    n.push(APS_Creator::CONFIRMAR)
    @command_window = Window_Command.new(160, n)
    @command_window.opacity = 100
    end
    #--------------------------------------------------------------------------
    # * Main Scene Change
    #--------------------------------------------------------------------------
    def main_scenechange?
    # Abort loop if screen is changed
    if $scene != self
    return true
    end
    return false
    end
    #--------------------------------------------------------------------------
    # * Main Dispose
    #--------------------------------------------------------------------------
    def main_dispose
    @background.dispose
    @window.dispose
    @command_window.dispose
    @classSprite.dispose
    end
    #--------------------------------------------------------------------------
    # * Main Loop
    #--------------------------------------------------------------------------
    def main_loop
    # Update game screen
    Graphics.update
    # Update input information
    Input.update
    # Frame update
    update
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
    #Update list58787452
    if @text.size == APS_Creator::MAX_CARACTERES
    @window.contents.font.color = APS_Creator::COR_MAX
    end
    if @text.size == APS_Creator::MAX_CARACTERES + 1
    update_menu
    if Input.triggerd?(Input::Back) and @text.size != 0
    @text.delete_at(-1)
    @text.delete_at(-1)
    end
    return
    end
    # Update
    update_windows
    update_menu
    update_rup_keys if !Input.pressed?(Input::Shift)
    update_rlow_keys if Input.pressed?(Input::Shift)
    @text.delete_at(-1) if Input.triggerd?(Input::Back) && @text.size != 0
    @text.push(" ") if Input.triggerd?(Input::Space)
    if @text.size <= APS_Creator::MAX_CARACTERES
    @window.contents.font.color = Color.new(255,255,255)
    end
    end
    #--------------------------------------------------------------------------
    # * Update list58787452
    #--------------------------------------------------------------------------
    def update_menu
    @command_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
    if @command_window.index == @classes.size
    filename = make_ON_filename if $online
    filename = make_OFF_filename if !$online
    $autofile = filename
    APS::new_game
    $game_party.actors[0].name = @text.to_s
    $game_party.actors[0].class_id = @data[0]
    $game_party.actors[0].set_graphic(User_Edit::CLASSES_GRAPHICS[@ind], 0, nil, 0)
    # Configurar posição inicial no mapa
    $game_map.setup($data_system.start_map_id)
    # Aqui o Jogador é movido até a posição inical configurada
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Atualizar Jogador
    $game_player.refresh
    # Rodar, de acordo com o mapa, a BGM e a BGS
    $game_map.autoplay
    # Atualizar mapa (executar processos paralelos)
    $game_map.update
    # Mudar para a tela do mapa
    $scene = Scene_Reinit.new
    else
    @ind = @command_window.index
    @data[0] = @classes[@command_window.index]
    @classSprite.bitmap = RPG::Cache.picture(@ims[@command_window.index])
    end
    end
    @data[1] = @text.to_s
    end
    #--------------------------------------------------------------------------
    # * Window Update
    #--------------------------------------------------------------------------
    def update_windows
    # Update Desc_Window
    @window.refresh(@data)
    end
    #-------------------------------------------------------------------------
    # * Updates UpperKeys
    #-------------------------------------------------------------------------
    def update_rup_keys
    #Checks for Numberkeys input.
    for key in Input::Numberkeys.keys
    @text.push(key.to_s) if Input.triggerd?(Input::Numberkeys[key])
    end
    #Checks for Letter input.
    for key in Input::Letters.keys
    @text.push(key.downcase.to_s) if Input.triggerd?(Input::Letters[key])
    end
    if APS_Creator::ESPECIAL_CARACTERES
    #Checks for other keys
    @text.push("-") if Input.triggerd?(Input::Underscore)
    @text.push(".") if Input.triggerd?(Input::Dot)
    @text.push(",") if Input.triggerd?(Input::Comma)
    @text.push("/") if Input.triggerd?(Input::Backslash)
    @text.push("'") if Input.triggerd?(Input::Quote)
    @text.push("=") if Input.triggerd?(Input::Equal)
    end
    end
    #-------------------------------------------------------------------------
    # * Updates LowerKeys
    #-------------------------------------------------------------------------
    def update_rlow_keys
    #Checks for Numberkeys input.
    if APS_Creator::ESPECIAL_CARACTERES
    for key in Input::Numberkeys.keys
    if Input.triggerd?(Input::Numberkeys[key])
    @text.push("!") if key == 1
    @text.push("@") if key == 2
    @text.push("#") if key == 3
    @text.push("$") if key == 4
    @text.push("%") if key == 5
    @text.push("^") if key == 6
    @text.push("&") if key == 7
    @text.push("*") if key == 8
    @text.push("(") if key == 9
    @text.push(")") if key == 0
    end
    end
    end
    if APS_Creator::MAIUSCULAS
    #Checks for Letter input.
    for key in Input::Letters.keys
    @text.push(key.upcase.to_s) if Input.triggerd?(Input::Letters[key])
    end
    end
    if APS_Creator::ESPECIAL_CARACTERES
    #Checks for Other keys
    @text.push("_") if Input.triggerd?(Input::Underscore)
    @text.push(">") if Input.triggerd?(Input::Dot)
    @text.push("<") if Input.triggerd?(Input::Comma)
    @text.push("?") if Input.triggerd?(Input::Backslash)
    @text.push("''") if Input.triggerd?(Input::Quote)
    @text.push("+") if Input.triggerd?(Input::Equal)
    end
    end

    def make_ON_filename
    if FileTest.exist?("Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save1.pdat")
    if FileTest.exist?("Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save2.pdat")
    if FileTest.exist?("Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save3.pdat")
    if FileTest.exist?("Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save4.pdat")
    n = nil
    else
    n = "Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save4.pdat"
    $player_code = 4
    end
    else
    n = "Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save3.pdat"
    $player_code = 3
    end
    else
    n = "Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save2.pdat"
    $player_code = 2
    end
    else
    n = "Saves/" + Network::Main.name + "-" + $server_key[0..5] + "_save1.pdat"
    $player_code = 1
    end
    return n
    end

    def make_OFF_filename
    if FileTest.exist?("Saves/" + "Singleplayer_save1.pdat")
    if FileTest.exist?("Saves/" + "Singleplayer_save2.pdat")
    if FileTest.exist?("Saves/" + "Singleplayer_save3.pdat")
    if FileTest.exist?("Saves/" + "Singleplayer_save4.pdat")
    n = nil
    else
    n = "Saves/" + "Singleplayer_save4.pdat"
    $player_code = 4
    end
    else
    n = "Saves/" + "Singleplayer_save3.pdat"
    $player_code = 3
    end
    else
    n = "Saves/" + "Singleplayer_save2.pdat"
    $player_code = 2
    end
    else
    n = "Saves/" + "Singleplayer_save1.pdat"
    $player_code = 1
    end
    return n
    end
    end
    #==============================================================================
    # Creator_Name_Window
    #==============================================================================
    class Creator_Name_Window < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
    super(302, 368, 338, 112)
    #Create Bitmap
    self.contents = Bitmap.new(width - 32, height - 32)
    #Z-Pos
    self.z = 100
    self.opacity = 100
    @cursor = "|"
    #Refresh and add the contents to window
    refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh(data = nil)
    #Clear Bitmap
    self.contents.clear
    if data.nil?
    return
    end
    #Add Contents
    if Graphics.frame_count % 10 == 0
    if @cursor == "|"
    @cursor = ""
    else
    @cursor = "|"
    end
    end
    self.contents.draw_text(0,0,200,32,APS_Creator::NOME+":" + data[1].to_s + @cursor)
    self.contents.draw_text(0,32,200,32,APS_Creator::CLASSE+":" + $data_classes[data[0]].name.to_s)
    end
    end




    Créditos




    Se usado no seu jogo, Shocks deverá estar nos créditos.

      Data/hora atual: Qui Mar 30, 2017 12:39 pm