Sign in to follow this  
Followers 0
Sampi

Script de hotel

4 posts in this topic

Ponerlo encima de main y para llamarlo usar esto
CODE
$scene = Scene_Inn.new(15, 15,"welcome", "owner", � "rest", "go
away" , "cya later", "not enough money", 10, "it cost 10 dollar", "I
will kill u if u don't rest today in peace")

Puedes cambiar los comandos

CODE
#=======================================
#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_CurrentMoney.new
@money.x = 360
@money.y = 290
@tone = Tone.new(0, 225, 225, 0)
   Graphics.transition
  loop do
    Graphics.update
    Input.update
    update
    if $scene != self
      break
    end
  end
 
  Graphics.freeze
  @tone.update
  @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
          $msg.delay(20) # Wait for some frame and close
          $scene = Scene_Map.new #Go to map
        end
      end
    end
   
     def change_back
          $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 20)
          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
         Audio.me_play("Audio/ME/" + "014-Inn01", 80, 80)
          $game_screen.start_tone_change(Tone.new(-255,-255,-255,0), 10)
        @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
          delay(15)
          Graphics.transition(100)
           $game_screen.start_tone_change(Tone.new(0,0,0,0), 10)
        @inn_window .set_text(@goodbye) # Goodbye message display
        delay(25) # 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


Aqui el ejemplo

[SPOILER]http://www.nearfantastica.org/programs/inn%20menu.zip[/SPOILER]
0

Share this post


Link to post
Share on other sites
Que vagos. Eso se hace por eventos. Pero buen aporte.
0

Share this post


Link to post
Share on other sites
Un buen script para vagos, pero la verdad es que me queda mucho mejor con eventos. Y de hecho es más cómodo...
0

Share this post


Link to post
Share on other sites
otro script para flojos xD.png voidzoneros flojeen!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0