赞 | 0 |
VIP | 24 |
好人卡 | 8 |
积分 | 1 |
经验 | 11412 |
最后登录 | 2017-8-21 |
在线时间 | 416 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 416 小时
- 注册时间
- 2006-10-21
- 帖子
- 1245
|
- #==============================================================================
- # ★ Teleport 特别感谢 Yoji Ojima
- #------------------------------------------------------------------------------
- # 制作传送道具或是技能的脚本。
- #==============================================================================
- # 瞬间传送的识别文字。
- # 将这段文字写在作为传送道具或技能的「备注」之中。
- # [效果范围] 设为 [无]、[使用场合] 设为 [菜单中] 。
- EXSKL_TELEPORT_SIGNATURE = "*TELEPORT"
- # 允许瞬间传送的开关 ID。
- # 当此号的开关为 ON 时,则可以使用传送物品/技能
- # 可以在事件内开启或关闭此功能。
- EXSKL_TELEPORT_PERMISSION_SID = 1
- # 瞬间移动列表。
- # 开关 ID、场所名称、地图 ID、X 座标、Y 座标、传送后角色面向 (对应四方键)
- # 依照上面的顺序填入
- # 当对应的开关为 ON 时,就能够选择该场所来瞬间移动。
- EXSKL_TELEPORT_PLACES =
- [
- [1, "雾江之村伊波", 29, 242, 191, 8],
- [1, "雪2崖" , 29, 246,242, 8],
- [1, "草1原" , 2,16, 9, 2],
- ]
- # 开关, 场所名称, 地图ID, X 座标, Y 座标, 面向
- # 传送时的 SE。
- # 依次指定 SE 的名称、音量、音调。(不指定时留 [])
- EXSKL_TELEPORT_SE = ["Teleport", 80, 100]
- #------------------------------------------------------------------------------
- class Game_Actor
- alias _exstlp_skill_can_use? skill_can_use?
- #--------------------------------------------------------------------------
- # ● 可用技能判断 (追加定义)
- # skill : 技能
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return false unless skill.is_a?(RPG::Skill)
- if skill.note.include?(EXSKL_TELEPORT_SIGNATURE)
- return false unless $game_party.teleport_can_use?
- return false if $game_player.in_vehicle?
- end
- return _exstlp_skill_can_use?(skill)
- end
- end
- class Game_Party
- alias _exstlp_item_can_use? item_can_use?
- #--------------------------------------------------------------------------
- # ● 可用物品判断 (追加定义)
- # item : 物品
- #--------------------------------------------------------------------------
- def item_can_use?(item)
- return false unless item.is_a?(RPG::Item)
- return false if item_number(item) == 0
- if item.note.include?(EXSKL_TELEPORT_SIGNATURE)
- return false unless teleport_can_use?
- return false if $game_player.in_vehicle?
- end
- return _exstlp_item_can_use?(item)
- end
- #--------------------------------------------------------------------------
- # ☆ 可用「瞬间移动」判定
- #--------------------------------------------------------------------------
- def teleport_can_use?
- return false if EXSKL_TELEPORT_PLACES.empty?
- return false unless $game_switches[EXSKL_TELEPORT_PERMISSION_SID]
- for place in EXSKL_TELEPORT_PLACES
- return true if $game_switches[place[0]]
- end
- return false
- end
- end
- #==============================================================================
- # ★ Window_Teleport
- #------------------------------------------------------------------------------
- # 显示可以移动的场所列表。
- #==============================================================================
- class Window_Teleport < Window_Selectable
- #--------------------------------------------------------------------------
- # ☆ 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 272, 416)
- refresh
- end
- #--------------------------------------------------------------------------
- # ☆ 获取项目
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ☆ 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @data = []
- for place in EXSKL_TELEPORT_PLACES
- if $game_switches[place[0]]
- @data.push(place)
- end
- end
- @item_max = [@data.size, 1].max
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 描绘项目
- # index : 项目索引
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- place = @data[index]
- if place != nil
- self.contents.draw_text(rect, place[1])
- end
- end
- end
- class Scene_Item
- alias _exstlp_start start
- alias _exstlp_terminate terminate
- alias _exstlp_update update
- alias _exstlp_determine_item determine_item
- #--------------------------------------------------------------------------
- # ○ 开始处理 (追加定义)
- #--------------------------------------------------------------------------
- def start
- _exstlp_start
- @teleport_window = Window_Teleport.new
- hide_teleport_window
- end
- #--------------------------------------------------------------------------
- # ○ 结束处理 (追加定义)
- #--------------------------------------------------------------------------
- def terminate
- _exstlp_terminate
- @teleport_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 更新画面 (追加定义)
- #--------------------------------------------------------------------------
- def update
- teleport_active = @teleport_window.active
- _exstlp_update
- @teleport_window.update
- if teleport_active
- update_teleport_selection
- end
- end
- #--------------------------------------------------------------------------
- # ○ 确认物品 (追加定义)
- #--------------------------------------------------------------------------
- def determine_item
- if @item.note.include?(EXSKL_TELEPORT_SIGNATURE)
- show_teleport_window(@item_window.index % 2 == 0)
- else
- _exstlp_determine_item
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 显示瞬间传送窗口
- # right : 靠右对齐标签(为false时则靠左)
- #--------------------------------------------------------------------------
- def show_teleport_window(right)
- @item_window.active = false
- width_remain = 544 - @teleport_window.width
- @teleport_window.x = right ? width_remain : 0
- @teleport_window.visible = true
- @teleport_window.active = true
- @teleport_window.index = 0
- if right
- @viewport.rect.set(0, 0, width_remain, 416)
- @viewport.ox = 0
- else
- @viewport.rect.set(@teleport_window.width, 0, width_remain, 416)
- @viewport.ox = @teleport_window.width
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 隐藏瞬间传送窗口
- #--------------------------------------------------------------------------
- def hide_teleport_window
- @item_window.active = true
- @teleport_window.visible = false
- @teleport_window.active = false
- @viewport.rect.set(0, 0, 544, 416)
- @viewport.ox = 0
- end
- #--------------------------------------------------------------------------
- # ☆ 更新瞬间传送选取
- #--------------------------------------------------------------------------
- def update_teleport_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- hide_teleport_window
- elsif Input.trigger?(Input::C)
- determine_teleport
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 确认瞬间传送
- #--------------------------------------------------------------------------
- def determine_teleport
- place = @teleport_window.item
- if place == nil
- Sound.play_buzzer
- else
- se = EXSKL_TELEPORT_SE
- RPG::SE.new(se[0], se[1], se[2]).play unless se.empty?
- $game_party.last_item_id = @item.id
- $game_party.consume_item(@item)
- $game_player.reserve_transfer(place[2], place[3], place[4], place[5])
- $scene = Scene_Map.new
- end
- end
- end
- class Scene_Skill
- alias _exstlp_start start
- alias _exstlp_terminate terminate
- alias _exstlp_update update
- alias _exstlp_determine_skill determine_skill
- #--------------------------------------------------------------------------
- # ○ 开始处理 (追加定义)
- #--------------------------------------------------------------------------
- def start
- _exstlp_start
- @teleport_window = Window_Teleport.new
- hide_teleport_window
- end
- #--------------------------------------------------------------------------
- # ○ 结束处理 (追加定义)
- #--------------------------------------------------------------------------
- def terminate
- _exstlp_terminate
- @teleport_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 更新画面 (追加定义)
- #--------------------------------------------------------------------------
- def update
- teleport_active = @teleport_window.active
- _exstlp_update
- @teleport_window.update
- if teleport_active
- update_teleport_selection
- end
- end
- #--------------------------------------------------------------------------
- # ○ 确认技能 (追加定义)
- #--------------------------------------------------------------------------
- def determine_skill
- if @skill.note.include?(EXSKL_TELEPORT_SIGNATURE)
- show_teleport_window(@skill_window.index % 2 == 0)
- else
- _exstlp_determine_skill
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 显示瞬间传送窗口
- # right : 靠右对齐标签(为false时则靠左)
- #--------------------------------------------------------------------------
- def show_teleport_window(right)
- @skill_window.active = false
- width_remain = 544 - @teleport_window.width
- @teleport_window.x = right ? width_remain : 0
- @teleport_window.visible = true
- @teleport_window.active = true
- @teleport_window.index = 0
- if right
- @viewport.rect.set(0, 0, width_remain, 416)
- @viewport.ox = 0
- else
- @viewport.rect.set(@teleport_window.width, 0, width_remain, 416)
- @viewport.ox = @teleport_window.width
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 隐藏瞬间传送窗口
- #--------------------------------------------------------------------------
- def hide_teleport_window
- @skill_window.active = true
- @teleport_window.visible = false
- @teleport_window.active = false
- @viewport.rect.set(0, 0, 544, 416)
- @viewport.ox = 0
- end
- #--------------------------------------------------------------------------
- # ☆ 更新瞬间传送选取
- #--------------------------------------------------------------------------
- def update_teleport_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- hide_teleport_window
- elsif Input.trigger?(Input::C)
- determine_teleport
- end
- end
- #--------------------------------------------------------------------------
- # ☆ 确认瞬间传送
- #--------------------------------------------------------------------------
- def determine_teleport
- place = @teleport_window.item
- if place == nil
- Sound.play_buzzer
- else
- se = EXSKL_TELEPORT_SE
- RPG::SE.new(se[0], se[1], se[2]).play unless se.empty?
- @actor.last_skill_id = @skill.id
- @actor.mp -= @actor.calc_mp_cost(@skill)
- $game_player.reserve_transfer(place[2], place[3], place[4], place[5])
- $scene = Scene_Map.new
- end
- end
- end
复制代码 |
|