赞 | 0 |
VIP | 0 |
好人卡 | 7 |
积分 | 2 |
经验 | 2033 |
最后登录 | 2024-8-5 |
在线时间 | 56 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 210
- 在线时间
- 56 小时
- 注册时间
- 2011-11-22
- 帖子
- 57
|
本帖最后由 linyifei 于 2012-7-23 11:22 编辑
我同时用了Beside的地图名称显示,以及水镜风生的物品负重限制脚本,想不到出现了冲突,虽然游戏没有崩溃什么的,但是地图名称无法显示了,不知道哪里出了问题。我把脚本发上来,希望可以得到解决。- #==============================================================================
- # 地图名及区域名显示 by Beside
- #------------------------------------------------------------------------------
- # 功能: 动态显示玩家所在区域及地图名。
- #==============================================================================
- MWINDOW_X = 20 # 窗口X坐标
- MWINDOW_Y = 20 # 窗口Y坐标
- WEIGH = 200 # 窗口宽度
- START_TIME = 30 # 窗口出现时间
- COUN_TIME = 50 # 窗口持续时间
- FADE_TIME = 30 # 窗口淡去时间
- TEXT1_SIZE = 20 # 地图名的字体大小
- TEXT2_SIZE = 18 # 区域名的字体大小
- TEXT3_SIZE = 18 # 附加名的字体大小
- TEXT1_COLOR = Color.new(255,255,255) # 地图名的默认颜色
- TEXT2_COLOR = 0 # 区域名的默认颜色代码(0-31)
- TEXT3_COLOR = 0 # 附加名的默认颜色代码(0-31)
- SKIN = "window" # 窗口皮肤的文件名
- HEIGHT = TEXT1_SIZE + TEXT2_SIZE + TEXT3_SIZE + 32
- #==============================================================================
- # ■ Window_Map
- #------------------------------------------------------------------------------
- # 显示当前进度中的所在场景名称的窗口。
- #==============================================================================
- class Window_Map < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @id = 0
- @a_id = 0
- super(MWINDOW_X, MWINDOW_Y, WEIGH, HEIGHT)
- self.opacity = 0
- self.contents_opacity = 0
- self.windowskin = Cache.system(SKIN)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @map_id = $game_map.map_id
- locationname = load_data("Data/MapInfos.rvdata")[@map_id].name
- if $game_player.area_id.is_a?(Numeric)
- if $game_player.area_id != @a_id or @map_id != @id
- self.contents.clear
- if @map_id != @id
- @id = @map_id
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, 0, WEIGH-32, TEXT1_SIZE, locationname, 1)
- end
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- @a_id = $game_player.area_id
- area_name = $data_areas[@a_id].name_p1
- other_name = $data_areas[@a_id].name_p2
- self.contents.font.size = TEXT2_SIZE
- self.contents.font.color = text_color($data_areas[@a_id].color_1)
- self.contents.draw_text(0, TEXT1_SIZE, WEIGH-32, TEXT2_SIZE, area_name, 1)
- self.contents.font.size = TEXT3_SIZE
- self.contents.font.color = text_color($data_areas[@a_id].color_2)
- self.contents.draw_text(0, TEXT1_SIZE+TEXT2_SIZE, WEIGH-32, TEXT3_SIZE, other_name, 1)
- end
- elsif @map_id != @id
- @id = @map_id
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.clear
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
- elsif @a_id != 0
- @a_id = 0
- @time_count = START_TIME + COUN_TIME + FADE_TIME
- self.contents.clear
- self.contents.font.color = TEXT1_COLOR
- self.contents.font.size = TEXT1_SIZE
- self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
- end
- if @time_count > COUN_TIME + FADE_TIME
- self.opacity += 255 / START_TIME
- self.contents_opacity += 255 / START_TIME
- @time_count -= 1
- elsif @time_count > FADE_TIME
- self.opacity = 255
- self.contents_opacity = 255
- @time_count -= 1
- elsif @time_count > 0
- self.opacity -= 255 / FADE_TIME
- self.contents_opacity -= 255 / FADE_TIME
- @time_count -= 1
- else
- @time_count = 0
- self.opacity = 0
- self.contents_opacity = 0
- end
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- alias _start start
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- @map_window = Window_Map.new
- _start
- end
-
- alias _terminate terminate
- def terminate
- @map_window.dispose
- _terminate
- end
-
- alias _update update
- def update
- @map_window.refresh
- _update
- end
- end
- module RPG
- class Area
- def name_p1
- name = @name.split(/#/)[0]
- return name != nil ? name : ""
- end
- def name_p2
- name = @name.split(/#/)[1]
- return name != nil ? name : ""
- end
- def color_1
- color = @name.split(/#/)[2]
- return color != nil ? color.to_i : TEXT2_COLOR
- end
- def color_2
- color = @name.split(/#/)[3]
- return color != nil ? color.to_i : TEXT3_COLOR
- end
- end
- end
- class Game_Character
- def area_id
- for area in $data_areas.values
- if in_area?(area)
- return area.id
- end
- end
- end
- end
复制代码- #==============================================================================
- # ■ 物品丢弃 + 物品种类数限制 —— by 水镜风生
- #------------------------------------------------------------------------------
- LOSE_ITEM_SE_NAME = "Evasion" # 丢弃物品时播放的SE
- LOW_SPEED = 2 # 物品超重时的移动速度
- USUAL_SPEED = 5 # 平时的移动速度
- ITEM_MAX_N = 18 # 储存物品最大种类数的事件变量的编号
- #==============================================================================
- # ■ Scene_Item
- #------------------------------------------------------------------------------
- # 处理物品画面的类。
- #==============================================================================
- class Scene_Item < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @viewport = Viewport.new(0, 0, 544, 416)
- @help_window = Window_Help.new
- @help_window.viewport = @viewport
- @item_window = Window_Item.new(0, 67, 544, 280)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.active = false
- @target_window = Window_MenuStatus.new(0, 0)
- @max_window = Window_Item_Max.new
- @max_window.viewport = @viewport
- @number_window = Window_LoseNumber.new(142, 156)
- @number_window.viewport = @viewport
- @command_window = Window_Command.new(145, [" 使用"," 丢弃"], 1, 2)
- @command_window.x = 200
- @command_window.y = 160
- hide_command_window
- hide_number_window
- hide_target_window
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @viewport.dispose
- @help_window.dispose
- @item_window.dispose
- @target_window.dispose
- @max_window.dispose
- @command_window.dispose
- @number_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 回到原画面
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new(0)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @help_window.update
- @item_window.update
- @target_window.update
- @max_window.update
- @command_window.update
- @number_window.update
- if @item_window.active
- update_item_selection
- elsif @target_window.active
- update_target_selection
- elsif @command_window.active
- update_command_selection
- elsif @number_window.active
- update_number_selection
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新物品选择
- #--------------------------------------------------------------------------
- def update_item_selection
- if Input.trigger?(Input::B)
- item_max = $game_variables[ITEM_MAX_N]
- item_max = 0 if item_max == nil
- if $game_party.items.size <= item_max # 如果物品种类没超过限制
- $game_player.change_move_speed(USUAL_SPEED)
- end
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::C)
- @item = @item_window.item
- if @item != nil
- $game_party.last_item_id = @item.id
- Sound.play_decision
- if $game_party.item_can_use?(@item) # 物品是否可用
- @command_window.draw_item(0,true)
- else @command_window.draw_item(0,false) # 不可用的话【使用】选项颜色无效
- end
- if @item.price == 0 # 物品价格是否为0
- @command_window.draw_item(1,false) # 是的话【丢弃】选项无效
- else
- @command_window.draw_item(1,true)
- end
- show_command_window
- else
- Sound.play_buzzer
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新目标选择
- #--------------------------------------------------------------------------
- def update_target_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if $game_party.item_number(@item) == 0 # 判断物品是否耗尽
- @item_window.refresh # 刷新窗口内容
- @max_window.refresh # 刷新物品种类窗口
- end
- hide_target_window
- elsif Input.trigger?(Input::C)
- if not $game_party.item_can_use?(@item)
- Sound.play_buzzer
- else
- determine_target
- end
- end
- end
- #--------------------------------------------------------------------------
- # ★ 更新指令选择
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- hide_command_window
- elsif Input.trigger?(Input::C)
- if @command_window.index == 0
- if $game_party.item_can_use?(@item)
- Sound.play_decision
- @command_window.active = false
- @command_window.visible =false
- determine_item
- else
- Sound.play_buzzer
- end
- elsif @item == nil or @item.price == 0
- Sound.play_buzzer
- else
- Sound.play_decision
- @command_window.active = false
- @command_window.visible =false
- max = $game_party.item_number(@item)
- @number_window.set(@item, max)
- show_number_window
- end
- end
- end
- #--------------------------------------------------------------------------
- # ★ 更新数量输入
- #--------------------------------------------------------------------------
- def update_number_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- hide_number_window
- elsif Input.trigger?(Input::C)
- Audio.se_play("Audio/SE/#{LOSE_ITEM_SE_NAME}", 80, 100)
- $game_party.lose_item(@item, @number_window.number)
- @item_window.refresh
- @max_window.refresh
- hide_number_window
- end
- end
- #--------------------------------------------------------------------------
- # ★ 显示指令选择窗口
- #--------------------------------------------------------------------------
- def show_command_window
- @command_window.index = 0
- @item_window.active = false
- @command_window.visible = true
- @command_window.active = true
- end
- #--------------------------------------------------------------------------
- # ★ 显示数量窗口
- #--------------------------------------------------------------------------
- def show_number_window
- @command_window.active = false
- @number_window.visible = true
- @number_window.active = true
- end
- #--------------------------------------------------------------------------
- # ★ 隐藏指令选择窗口
- #--------------------------------------------------------------------------
- def hide_command_window
- @item_window.active = true
- @command_window.visible = false
- @command_window.active = false
- @viewport.rect.set(0, 0, 544, 416)
- @viewport.ox = 0
- end
- #--------------------------------------------------------------------------
- # ★ 隐藏数量窗口
- #--------------------------------------------------------------------------
- def hide_number_window
- @item_window.active = true
- @number_window.visible = false
- @number_window.active = false
- @viewport.rect.set(0, 0, 544, 416)
- @viewport.ox = 0
- end
- end
- #==============================================================================
- # ■ Window_lost_item
- #------------------------------------------------------------------------------
- # 显示物品丢弃数量的窗口,仿 Window_ShopNumber。
- #==============================================================================
- class Window_LoseNumber < Window_Base
- #--------------------------------------------------------------------------
- # ★ 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 260, 104)
- @item = nil
- @max = 1
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ★ 设置物品、最大数量
- #--------------------------------------------------------------------------
- def set(item, max)
- @item = item
- @max = max
- @number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ★ 设置数量输入
- #--------------------------------------------------------------------------
- def number
- return @number
- end
- #--------------------------------------------------------------------------
- # ★ 刷新
- #--------------------------------------------------------------------------
- def refresh
- y = 24
- self.contents.clear
- draw_item_name(@item, 0, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(164, y, 20, WLH, "×")
- self.contents.draw_text(190, y, 20, WLH, @number, 2)
- self.cursor_rect.set(186, y, 28, WLH)
- end
- #--------------------------------------------------------------------------
- # ★ 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- if self.active
- last_number = @number
- if Input.repeat?(Input::RIGHT) and @number < @max
- @number += 1
- end
- if Input.repeat?(Input::LEFT) and @number > 1
- @number -= 1
- end
- if Input.repeat?(Input::UP) and @number < @max
- @number = [@number + 10, @max].min
- end
- if Input.repeat?(Input::DOWN) and @number > 1
- @number = [@number - 10, 1].max
- end
- if @number != last_number
- Sound.play_cursor
- refresh
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Item_Max
- #-----------------------------------------------------------------------------
- # 显示背包容量和当前物品数的窗口
- #============================================================================
- class Window_Item_Max < Window_Base
- #--------------------------------------------------------------------------
- # ★ 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(290, 360, 254, 56)
- refresh
- end
-
- #--------------------------------------------------------------------------
- # ★ 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_icon(144, 0, 0)
- self.contents.draw_text(36, 0, 100, 24, "背包容量:")
- item = $game_party.items
- string = item.size.to_s
- item_max = $game_variables[ITEM_MAX_N]
- item_max = 0 if item_max == nil
- self.contents.font.color = knockout_color if item.size > item_max
- self.contents.draw_text(135, 0, 30, 24, string, 2)
- self.contents.font.color = normal_color
- string = "/ " + item_max.to_s
- self.contents.draw_text(173, 0, 100, 24, string )
- end
- end
- #==============================================================================
- # ■ Window_Waring
- #-----------------------------------------------------------------------------
- # 显示超重警告的窗口
- #============================================================================
- class Window_Waring < Window_Base
- def initialize
- super(544 - 180, 416 - 56, 180, 56)
- refresh
- end
-
- def refresh
- self.contents.clear
- self.contents.draw_text(0, -4, 150, 32, "你已经超重了。")
- end
- end
- #==============================================================================
- # Game_Player 添加更改移动速度的方法
- #============================================================================
- class Game_Player
- def change_move_speed(n)
- @move_speed = n
- end
- end
- #==============================================================================
- # Scene_Map 添加在地图上显示警告窗口的处理
- #============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_map.refresh
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- @waring_window = Window_Waring.new
- @waring_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
- @spriteset.dispose_characters # 为了生成背景隐藏角色
- end
- snapshot_for_background
- @spriteset.dispose
- @message_window.dispose
- @waring_window.dispose
- if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
- perform_battle_transition # 执行战斗前变换
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- $game_map.interpreter.update # 更新解释器
- $game_map.update # 更新滴入
- $game_player.update # 更新玩家
- $game_system.update # 更新计时器
- @spriteset.update # 更新活动块元件
- @message_window.update # 更新消息窗口
- unless $game_message.visible # 正在显示消息以外的情况
- update_transfer_player
- update_encounter
- update_call_menu
- update_call_debug
- update_scene_change
- update_over_item
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新物品超限判定
- #--------------------------------------------------------------------------
- def update_over_item
- item_max = $game_variables[ITEM_MAX_N]
- item_max = 0 if item_max == nil
- if $game_party.items.size > item_max
- @waring_window.visible = true
- $game_player.change_move_speed(LOW_SPEED)
- else
- @waring_window.visible = false
- end
- end
- end
复制代码 |
|