Войти на сайт

Авторизация, ждите ...
×

ТЕМА: (XP)Simple City Navigation Script

(XP)Simple City Navigation Script 16 года 4 мес. назад #21429

  • Enyo
  • Enyo аватар
  • Вне сайта
  • Просветлённый
  • Скриптер
  • Сообщений: 251
  • Спасибо получено: 4
Автор: Xk8
Описание: Понятно и без слов=)

[cut]
=begin
City Navigation Menu by Xk8 (Level: Simple) Give Credit to use.
 
I made this script out of a custom script for my project. It was requested
from the Screenshot topic. I made it as easy to use as possible (At the cost
of practical scripting.)
 
In this script, your  capital  will have 10 areas. e.g. Castle, Residential
areas, Shop District etc.
 
If you want more areas, figure it out for yourself, it s to tedious to type,
and it s easy to understand.
 
How to use:
 
FIRST: @variable_id_desc = 1 #use an empty variable here
  use a non-used variable number here. It is used to determine 
  which option to be selected and link it to it s description.
 
  First editable = Area Descriptions, this is what you see at  4  in the 
  screenshot
 
  Second editable =  Where do you want to go  at line 89, seen at  1 
 
  Third editable = show the actor graphic, as seen at  5 , this can be done
  at line 115
 
  Fourth Editable = Names of the maps you can teleport to,  starting
  at line 129
 
  Fifth Editable The name of the background at line 141. This must be in 
  the panorama folder.  6 
 
  Sixth Editable = Icon names, starting at line 149, see  3 
 
  Seventh Editable = The names of the maps as seen at  2 . line 227
 
  All the maps you teleport to, will automatically teleport you to 
  the coordinates (0, 0). You can change this per map. Find these lines
 
  $game_player.moveto(0, 0)
 
  at the bottom of Scene_City. These are the coordinates per map.  when 0 
  being area 1 and so on.
 
  CALL THE SCRIPT WITH THIS COMMAND: $scene = Scene_City.new
=end
class Window_Citydesc   Window_Base
 
  attr_accessor :variable_id_desc
 
  def initialize
    super(0, 0, 400, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 100
    @variable_id_desc = 1 #use an empty variable here
    refresh
  end
 
  def refresh
    if $game_variables[@variable_id_desc] == 0
      desc =  Description of Area 1.  #These are the area descriptions
    elsif $game_variables[@variable_id_desc] == 1 
      desc =  Description of Area 2.  #These are editable
    elsif $game_variables[@variable_id_desc] == 2
      desc =  Description of Area 3. 
    elsif $game_variables[@variable_id_desc] == 3
      desc =  Description of Area 4. 
    elsif $game_variables[@variable_id_desc] == 4
      desc =  Description of Area 5. 
    elsif $game_variables[@variable_id_desc] == 5
      desc =  Description of Area 6. 
    elsif $game_variables[@variable_id_desc] == 6
      desc =  Description of Area 7. 
    elsif $game_variables[@variable_id_desc] == 7
      desc =  Description of Area 8. 
    elsif $game_variables[@variable_id_desc] == 8
      desc =  Description of Area 9. 
    elsif $game_variables[@variable_id_desc] == 9
      desc =  Description of Area 10. 
    end
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 640, 32, desc)
  end
end
 
class Window_Command_City   Window_Selectable
 
  def initialize(width, commands)
 
    super(0, 0, width, commands.size * 32 + 64)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
    refresh
    self.index = 0
  end
 
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
 
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index + 32, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 
    self.contents.draw_text(rect, @commands[index])
 
    self.contents.draw_text(4, 0, 160, 32,  Where do you want to go? )
  end
 
  def disable_item(index)
    draw_item(index, disabled_color)
  end
 
  def update_cursor_rect
    self.cursor_rect.set(0, @index * 32 + 32, self.width - 32, 32)
  end
end
 
class Window_CityStatus   Window_Selectable
 
  def initialize
    super(0, 0, 480, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
    self.active = false
    self.index = -1
  end
 
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
       actor = $game_party.actors[i]
      draw_actor_graphic(actor,i * 64 + 20, 60) #Show the actor graphic
    end
  end
end
 
 
class Scene_City
 
  def initialize(menu_index = 0)
    @menu_index = menu_index
    @area_name_1 =  MAP001  #These are the map names of the 
    @area_name_2 =  MAP002  #possible areas
    @area_name_3 =  MAP003  #edit these to the names of your areas
    @area_name_4 =  MAP004 
    @area_name_5 =  MAP005 
    @area_name_6 =  MAP006 
    @area_name_7 =  MAP007 
    @area_name_8 =  MAP008 
    @area_name_9 =  MAP009 
    @area_name_10 =  MAP010 
 
    @backdrop_name =  006-Mountains01  #the name of the PANORAMA used as 
                                  #background for your city navigation.
                                  
    @icon_name1 =  019-accessory04  #these are the icons you see
    @icon_name2 =  001-Weapon01     #left of the options. editable.
    @icon_name3 =  009-Shield01 
    @icon_name4 =  041-Item10 
    @icon_name5 =  032-Item01 
    @icon_name6 =  042-Item11 
    @icon_name7 =  042-Item11 
    @icon_name8 =  042-Item11 
    @icon_name9 =  042-Item11 
    @icon_name10 =  025-Herb01 
  end
 
  def main
    @backdrop = Sprite.new
    @backdrop.bitmap = RPG::Cache.panorama(@backdrop_name, $game_map.panorama_hue)
 
    @icon1 = Sprite.new
    @icon1.bitmap = RPG::Cache.icon(@icon_name1)
    @icon1.x = 42
    @icon1.y = 96
    @icon1.z = 9999
 
    @icon2 = Sprite.new
    @icon2.bitmap = RPG::Cache.icon(@icon_name2)
    @icon2.x = 42
    @icon2.y = 128
    @icon2.z = 9999
 
    @icon3 = Sprite.new
    @icon3.bitmap = RPG::Cache.icon(@icon_name3)
    @icon3.x = 42
    @icon3.y = 160
    @icon3.z = 9999
 
    @icon4 = Sprite.new
    @icon4.bitmap = RPG::Cache.icon(@icon_name4)
    @icon4.x = 42
    @icon4.y = 192
    @icon4.z = 9999
 
    @icon5 = Sprite.new
    @icon5.bitmap = RPG::Cache.icon(@icon_name5)
    @icon5.x = 42
    @icon5.y = 224
    @icon5.z = 9999
 
    @icon6 = Sprite.new
    @icon6.bitmap = RPG::Cache.icon(@icon_name6)
    @icon6.x = 42
    @icon6.y = 256
    @icon6.z = 9999
 
    @icon7 = Sprite.new
    @icon7.bitmap = RPG::Cache.icon(@icon_name7)
    @icon7.x = 42
    @icon7.y = 288
    @icon7.z = 9999
 
    @icon8 = Sprite.new
    @icon8.bitmap = RPG::Cache.icon(@icon_name8)
    @icon8.x = 42
    @icon8.y = 320
    @icon8.z = 9999
 
    @icon9 = Sprite.new
    @icon9.bitmap = RPG::Cache.icon(@icon_name9)
    @icon9.x = 42
    @icon9.y = 352
    @icon9.z = 9999
 
    @icon10 = Sprite.new
    @icon10.bitmap = RPG::Cache.icon(@icon_name10)
    @icon10.x = 42
    @icon10.y = 384
    @icon10.z = 9999
 
    s1 =  Go to Area 1  #Names of the Areas on the menu. Editable.
    s2 =  Go to Area 2 
    s3 =  Go to Area 3 
    s4 =  Go to Area 4 
    s5 =  Go to Area 5 
    s6 =  Go to Area 6 
    s7 =  Go to Area 7 
    s8 =  Go to Area 8 
    s9 =  Go to Area 9 
    s10 =  Go to Area 10 
    @command_window = Window_Command_City.new(180, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10])
    @command_window.index = @menu_index
    @command_window.opacity = 100
    @command_window.x = 50
    @command_window.y = 80 - 32
 
    @status = Window_CityStatus.new
    @status.x = 360
    @status.y = 390
 
    @desc = Window_Citydesc.new
    @desc.x = 230
    @desc.y = 80
    @desc.z = 9999
    @variable_id_desc = @desc.variable_id_desc
 
    Graphics.transition
 
    loop do
      Graphics.update
      Input.update
      update
 
      if $scene != self
        break
      end
    end
 
    Graphics.freeze
 
    @command_window.dispose
    @backdrop.dispose
    @icon1.dispose
    @icon2.dispose
    @icon3.dispose
    @icon4.dispose
    @icon5.dispose
    @icon6.dispose
    @icon7.dispose
    @icon8.dispose
    @icon9.dispose
    @icon10.dispose
    @status.dispose
    @desc.dispose
  end
 
  def update
    $game_variables[@variable_id_desc] = @command_window.index
    @desc.refresh
    @icon1.opacity = 100
    @icon2.opacity = 100
    @icon3.opacity = 100
    @icon4.opacity = 100
    @icon5.opacity = 100
    @icon6.opacity = 100
    @icon7.opacity = 100
    @icon8.opacity = 100
    @icon9.opacity = 100
    @icon10.opacity = 100
    case @command_window.index
       when 0
         @icon1.opacity = 255
         @desc.y = 80
       when 1
         @icon2.opacity = 255
         @desc.y = 80+32
       when 2
         @icon3.opacity = 255
         @desc.y = 80 + 64
       when 3
         @icon4.opacity = 255
         @desc.y = 80 + 96
        when 4
         @icon5.opacity = 255
         @desc.y = 80 + 128
        when 5
         @icon6.opacity = 255
         @desc.y = 80 + 160
        when 6
         @icon7.opacity = 255
         @desc.y = 80 + 192
        when 7
         @icon8.opacity = 255
         @desc.y = 80 + 224
        when 8
         @icon9.opacity = 255
         @desc.y =  80 + 256
        when 9
         @icon10.opacity = 255
         @desc.y = 80 + 288
     end
 
    @command_window.update
    if @command_window.active
      update_command
      return
    end
  end
 
  def update_command
    if Input.trigger?(Input::C)
       $map_infos = load_data( Data/MapInfos.rxdata )
    case @command_window.index
      when 0  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
            if $map_infos[key].name == @area_name_1
              $game_map.setup(key)
              $game_player.moveto(0, 0)
              $game_player.refresh
              $game_map.autoplay
              $game_map.update
              $scene = Scene_Map.new
            end
          end
      when 1  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_2
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
      when 2  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_3
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
      when 3  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_4
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
      when 4  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_5
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
      when 5  
        $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_6
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
        when 6
          $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_7
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
          when 7
            $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_8
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
            when 8
              $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_9
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
              when 9
                $game_system.se_play($data_system.decision_se)
          for key in $map_infos.keys
              if $map_infos[key].name == @area_name_10
                $game_map.setup(key)
                $game_player.moveto(0, 0)
                $game_player.refresh
                $game_map.autoplay
                $game_map.update
                $scene = Scene_Map.new
              end
            end
          end
      return
    end
  end
end
[/cut]
Администратор запретил публиковать записи гостям.

(XP)Simple City Navigation Script 16 года 4 мес. назад #21434

  • Тэйлс
  • Тэйлс аватар
  • Вне сайта
  • Светлый дракон
  • набираю текст, ударяясь лицом об клавиатуру
  • Сообщений: 509
  • Спасибо получено: 4
Мона теперь интерактивные новеллы делать))
Администратор запретил публиковать записи гостям.
Модераторы: NeKotZima
Время создания страницы: 0.245 секунд