赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2690 |
最后登录 | 2015-4-29 |
在线时间 | 58 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 58 小时
- 注册时间
- 2007-8-10
- 帖子
- 284
|
我现在用这个和人物跟随 没有冲突
- #==============================================================================
- # 传送点系统(仿暗黑) by 沉影不器
- #------------------------------------------------------------------------------
- # 功能: 仿暗黑制作的传送点,在传送点确定键即激活传送点,各个已激活的传送点之间可
- # 相互传送.指向当前所在地图的选项不传送;要求金钱的地图,钱不够不传送.
- # 为节省位置,折成两列显示
- #------------------------------------------------------------------------------
- # 使用说明: ① 复制脚本插入到main之间
- # ② 传送点的事件脚本中写 $scene = Scene_Way_points.new(@event_id)
- # (无能范例中,传送点事件添加美化用的独立开关)
- # ③ 在RM地图设置里给每张有传送点的地图取个名称
- # ④ 要求金钱的地图,在名称后添加",金钱数"(不包括引号),详见范例
- #==============================================================================
- module WP
- # 脚本参数设定:
- WP_WIDTH = 180 # 自定义每列地图选项的宽度(共两列)
- WP_ANIMATION = 101 # 自定义传送时显示的动画id
- WP_ICON = "038-Item07" # 自定义地图选项的图标名称
- # 您也可以为每个地图设置单独图标
- SELF_ICON = false # 开关打开后将描绘Icons文件夹下与地图名相同的图标
- end
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :commands # 传送点选项
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias way_points_ini initialize
- def initialize
- @commands = []
- way_points_ini
- end
- end
- #==============================================================================
- # ■ Window_WP_Help
- #==============================================================================
- class Window_WP_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- x = 320 - WP::WP_WIDTH
- y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 + 96 : 176)
- super(x, y, WP::WP_WIDTH*2, 96)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 160
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text1 : 地图名
- # text2 : 金钱数
- #--------------------------------------------------------------------------
- def set_text(text1, text2)
- if text1 != @text1 or text2 != @text2
- @text1 = text1
- @text2 = text2
- # 再描绘文本
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, self.width - 40, 32, text1 + "传送点")
- self.contents.font.color = normal_color
- if text2 == 0
- text2 = "免费传送"
- else
- text2 = "花费" + text2.to_s + $data_system.words.gold
- end
- self.contents.draw_text(4, 32, self.width - 40, 32, text2, 2)
- end
- self.visible = true
- end
- end
- #==============================================================================
- # ■ Window_Way_Points
- #==============================================================================
- class Window_Way_Points < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化
- # map_id : 当前事件 id
- #--------------------------------------------------------------------------
- def initialize(event_id)
- #@event_id = event_id
- @column_max = 2
- mapinfo = load_data("Data/MapInfos.rxdata")
- id = $game_map.map_id
- map_name = mapinfo[id].name.split(/,/)[0]
- cost = mapinfo[id].name.split(/,/)[1] == nil ? 0 : mapinfo[id].name.split(/,/)[1].to_i
- $game_system.commands = setup(id, map_name, cost, event_id)
- x = 320 - WP::WP_WIDTH
- y = 240 - ($game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 16 : 80)
- super(x, y, WP::WP_WIDTH*2, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32+32 : 192)
- @item_max = $game_system.commands.size
- @column_max = 2
- self.contents = Bitmap.new(WP::WP_WIDTH*2 - 32, $game_system.commands.size < 10 ? ($game_system.commands.size+1)/2 * 32 : 160)
- self.opacity = 160
- refresh
- # 光标停留在当前地图选项
- self.index = now_index(id)
- end
- #--------------------------------------------------------------------------
- # ● 选项设定
- # map_id : 地图编号
- # map_name : 地图名称
- # cost : 花费
- # map_id : 当前事件 id
- #--------------------------------------------------------------------------
- def setup(map_id, map_name, cost ,event_id)
- map_commands = $game_system.commands
- if !map_commands.include?([map_id, map_name, cost ,event_id])
- map_commands.push([map_id, map_name, cost ,event_id])
- end
- return map_commands
- end
- #--------------------------------------------------------------------------
- # ● 是否能传送
- # index : 选项编号
- #--------------------------------------------------------------------------
- def transportable?(index)
- if $game_system.commands.empty?
- return false
- end
- map_id = $game_system.commands[index][0]
- cost = $game_system.commands[index][2]
- if map_id!= $game_map.map_id and cost <= $game_party.gold
- return true
- else
- return false
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取地图 id
- #--------------------------------------------------------------------------
- def item
- return $game_system.commands[self.index][0]
- end
- #--------------------------------------------------------------------------
- # ● 获取当前地图 index
- # map_id : 地图编号
- #--------------------------------------------------------------------------
- def now_index(map_id)
- now_index = 0
- for i in 0...$game_system.commands.size
- if $game_system.commands[i][0] == map_id
- now_index = i
- break
- end
- end
- return now_index
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @item_max = $game_system.commands.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- if transportable?(index)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * WP::WP_WIDTH
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- # 显示图标
- if WP::SELF_ICON
- bitmap = RPG::Cache.icon($game_system.commands[index][1])
- else
- bitmap = RPG::Cache.icon(WP::WP_ICON)
- end
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, WP::WP_WIDTH-36, 32, $game_system.commands[index][1])
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助
- #--------------------------------------------------------------------------
- def update_help
- # 地图名称
- text1 = $game_system.commands[self.index][1]
- # 花费
- text2 = $game_system.commands[self.index][2]
- @help_window.set_text(text1, text2)
- end
- end
- #==============================================================================
- # ■ Scene_Way_points
- #==============================================================================
- class Scene_Way_points
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # map_id : 当前事件 id
- #--------------------------------------------------------------------------
- def initialize(event_id)
- @event_id = event_id
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- @map_sprite = Spriteset_Map.new
- @way_points_window = Window_Way_Points.new(@event_id)
- @help_window = Window_WP_Help.new
- @way_points_window.help_window = @help_window
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @way_points_window.dispose
- @map_sprite.dispose
- Graphics.update
- end
- #--------------------------------------------------------------------------
- # ● 取得传送点坐标
- # map_id : 地图编号
- #--------------------------------------------------------------------------
- def way_point_xy(map_id)
- new_map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
- index = @way_points_window.index
- i = $game_system.commands[index][3].to_i
- return [new_map.events[i].x,new_map.events[i].y]
- end
- #--------------------------------------------------------------------------
- # ● 传送
- # map_id : 地图编号
- #--------------------------------------------------------------------------
- def trans(map_id)
- event_xy = way_point_xy(map_id)
- if event_xy != nil
- # 移动
- $game_temp.player_transferring = true
- $game_temp.player_new_map_id = map_id
- $game_temp.player_new_x = event_xy[0]
- $game_temp.player_new_y = event_xy[1]
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @help_window.update
- @way_points_window.update
- # 按下取消键的情况下
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Map.new
- return
- end
- # 按下确定键的情况下
- if Input.trigger?(Input::C)
- index = @way_points_window.index
- # 排除无法传送的情况
- if !@way_points_window.transportable?(index)
- $game_system.se_play($data_system.buzzer_se)
- else
- # $game_system.se_play($data_system.decision_se)
- # 传送
- map_id = @way_points_window.item
- trans(map_id)
- # 扣钱
- $game_party.gain_gold(-$game_system.commands[index][2])
- # 动画 <------ Iselia雪 的方法
- $game_player.animation_id = WP::WP_ANIMATION
- $data_animations[WP::WP_ANIMATION].frame_max.times do
- Graphics.update
- @map_sprite.update
- end
- $scene = Scene_Map.new
- return
- end
- end
- end
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|