赞 | 1 |
VIP | 0 |
好人卡 | 18 |
积分 | 1 |
经验 | 6526 |
最后登录 | 2013-7-5 |
在线时间 | 334 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 334 小时
- 注册时间
- 2011-10-21
- 帖子
- 413
|
本帖最后由 消失的三千 于 2012-3-28 18:40 编辑
这貌似用来制作地图技能的吧?
我试写个看看……
原本想要仿物品选择处理,不过太困难了= =所以转用界面来选择了(原谅我吧OTL)
用法:
62行可以更改控制ID(A变量)
然后变更A变量为保存技能ID的变量ID(B变量)- SceneManager.call(Scene_SkillChoice)
复制代码 这语句用来打开界面
打开界面前请把B变量归零- class Window_Skill < Window_Selectable
- def initialize(x, y, width, height)
- super
- @actor = nil
- @stype_id = 0
- @data = []
- end
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- self.oy = 0
- end
- def stype_id=(stype_id)
- return if @stype_id == stype_id
- @stype_id = stype_id
- refresh
- self.oy = 0
- end
- def col_max
- return 2
- end
- def item_max
- @data ? @data.size : 1
- end
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- def include?(item)
- item && item.stype_id == @stype_id
- end
- def make_item_list
- @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
- end
- def draw_item(index)
- skill = @data[index]
- if skill
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y)
- end
- end
- def update_help
- @help_window.set_item(item)
- end
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- def process_ok
- Sound.play_ok
- Input.update
- deactivate
- call_ok_handler
- end
- end
- class Scene_SkillChoice < Scene_MenuBase
- def start
- super
- @vid = $game_variables[10]
- create_background
- create_command_window
- create_item_window
- @status_window = Window_MenuStatus.new(80, 0)
- @status_window.select_last
- @status_window.activate
- @status_window.set_handler(:ok, method(:select_actor))
- @status_window.set_handler(:cancel, method(:return_scene))
- end
- def create_command_window
- @command_window = Window_SkillCommand.new(0, 0)
- @command_window.viewport = @viewport
- @command_window.help_window = @help_window
- @command_window.openness = 0
- @command_window.set_handler(:skill, method(:select_skill))
- @command_window.set_handler(:cancel, method(:return_select_actor))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- def create_item_window
- @skill_window = Window_Skill.new(64, 64, 416, 288)
- @skill_window.help_window = @help_window
- @skill_window.index = 0
- @skill_window.openness = 0
- @skill_window.set_handler(:ok, method(:choice_skill))
- @skill_window.set_handler(:cancel, method(:return_select_skill))
- @command_window.skill_window = @skill_window
- end
- def select_actor
- @status_window.close
- @skill_window.actor = $game_party.members[@status_window.index]
- @skill_window.open
- @command_window.actor = $game_party.members[@status_window.index]
- @command_window.open
- @command_window.activate
- end
- def return_select_actor
- @command_window.close
- @skill_window.close
- @status_window.open
- @status_window.activate
- end
- def select_skill
- @command_window.close
- @skill_window.actor = $game_party.members[@status_window.index]
- @skill_window.activate
- end
- def return_select_skill
- @command_window.actor = $game_party.members[@status_window.index]
- @command_window.open
- @command_window.activate
- end
- def choice_skill
- $game_variables[@vid] = @skill_window.item.id
- p $game_variables[@vid]
- SceneManager.return
- end
- end
复制代码 好吧我这渣渣在前辈面前献丑了……Orz |
评分
-
查看全部评分
|