Inn Alternativo

20 de fevereiro de 2013

Scene_Inn é um script para o RPG Maker XP, criado por rpgmaker, que cria um sistema de Inn alternativo em um projeto/game desta ferramenta.

A utilização é bem simples, sendo chamado através de eventos (veja a demo) e sem precisar de editar o script para traduzir para português ou ingles:

$scene = Scene_Inn.new(15, 15,"Bem Vindo", 
"imagem1.png",  "Descançar", "Sair" , "Ir Emborar", 
"Sem dinheiro", 100, "Custa:", "Eu vou te matar se vc 
não descançar em paz;")

Atenção: Convém corrigir os erros de português depois de copiar e colar o evento no seu projeto.

E, para instalar, basta copiar e colar o código abaixo, em cima do Main:

class Game_Party
 attr_accessor :gold
end

#=======================================
#Scene_Inn===============================
#created by rpgmaker=======================
#=======================================
class Scene_Inn
 def initialize(x, y,message, picture,  command1, command2, goodbye, lessmoney, price, set_price, whatnext)
     @x = x # The x position for the selection window
       @y = y # The y position for the selection window
         @message = message # Message display
         @picture = picture # sprite for inn keeper, can be left blank, u add ""
   @command1 = command1 # option one
   @command2 = command2  #option two
   @goodbye = goodbye # Message that will be shown when leaving Inn
   @lessmoney = lessmoney # If Price is less
   @price = price # Cost for the inn
   @set_price = set_price # Show message for price
   @whatnext = whatnext # Show what next when u select No
   end

 def main
 @spriteset = Spriteset_Map.new
 @sprite = Sprite.new
 @sprite.bitmap = RPG::Cache.picture(@picture)
 @sprite.x = 63
 @sprite.y = 95
 @sprite.opacity = 100
 @sprite.z = 300
 @dummy_window = Window_Base.new(55, 90, 95, 90)
 @inn_window = Window_Help.new
 @inn_window .x = 150
 @inn_window .y = 90
 @inn_window .width = 400
 @inn_window .height = 90
 @inn_window .set_text(@message) # Message display
 @selection = Window_Command.new(160, [@command1, @command2]) # Command display
 @selection.x = @x
 @selection.y = @y
 @selection.visible = true
 @selection.active = true
 @option = Window_Command.new(160, ["Yes", "No"])
 @option.x = @selection.x
 @option.y = @selection.y
 @option.visible = false
 @option.active = false
  @money = Window_Gold.new
 @money.x = 360
 @money.y = 290
    Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end

   Graphics.freeze
   @spriteset.dispose
   @sprite.dispose
   @dummy_window.dispose
   @inn_window.dispose
   @selection.dispose
   @option.dispose
   @money.dispose
 end

 def update
    @spriteset.update
   @sprite.update
   @dummy_window.update
   @inn_window.update
   @selection.update
   @option.update
   @money.update
   if @selection.active
     update_selection
     return
   end
   if @option.active
     update_options
     return
   end
 end

 def update_selection

   #Return to the map
   if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end

    #Trigger Selected actions
    if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       case @selection.index
       when 0 #Open options
       @selection.visible = false
       @selection.active = false
       @option.active = true
       @option.visible = true
       @inn_window .set_text(@set_price)
         when 1 # Close Options
           @inn_window .set_text(@goodbye) # Goodbye message display
           delay(20) # Wait for some frame and close
           $scene = Scene_Map.new #Go to map
         end
       end
     end

     def update_options
       @value = $game_party.gold
       if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @option.active = false
      @option.visible = false
      @selection.active = true
      @selection.visible = true
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @value < @price
        $game_system.se_play($data_system.buzzer_se)
        @inn_window .set_text(@lessmoney) # Show if money is not enough
        return
      end
       case @option.index
       when 0 #Heal player
         @value  -= @price
         $game_party.gold = @value
         @money.refresh
         for i in 0...$game_party.actors.size
           @actor = $game_party.actors[i]
           @actor.hp = @actor.maxhp
           @actor.sp = @actor.maxsp
         end
         @inn_window .set_text(@goodbye) # Goodbye message display
         delay(20) # Wait for some frame and close
         $scene = Scene_Map.new #Go to map
         when 1 # Close Options
           @inn_window .set_text(@whatnext)
          @option.active = false
      @option.visible = false
      @selection.active = true
      @selection.visible = true
         end
    end

     end
   end #End of Class
   def delay(wait)
count = Graphics.frame_count
while wait + count >= Graphics.frame_count
Graphics.update
end
end
autor, site, canal ou publisher rpgmaker tamanho 867KB licençaGrátis sistemas operacionais compativeisWindows 98/98SE/Me/2000/XP/Vista/7 download link DOWNLOAD

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Clique aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!