赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2789 |
最后登录 | 2014-1-30 |
在线时间 | 110 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 110 小时
- 注册时间
- 2012-10-11
- 帖子
- 59
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 hcm 于 2013-3-4 13:50 编辑
我已经有了任务菜单!也可以进去
请问怎么在公共事件里设置任务,然后可以在那里查看?而且在里面分主线 普通 循环?
这是任务菜单脚本:- #==============================================================================#
- # 任务系统v0.2 by EngShun #
- # #
- # 简单说明: #
- # 调用方法:$scene = Scene_Mission.new #
- # 用$game_party.mission.get(任务名,说明)得到任务 #
- # 用$game_party.mission.done(任务名)完成任务 #
- # 用$game_party.mission.delete(任务名)删除任务 #
- # 用$game_party.mission.done_all完成所有任务 #
- # 用$game_party.mission.delete_all删除所有任务 #
- # #
- # 效果说明: #
- # 支持普通对话框效果 #
- # \\a[号码] :更改对齐方式(0,1,2)。 #
- # \\itm[物品id] :物品数量 #
- # \\wpn[武器id] :武器数量 #
- # \\amr[防具id] :防具数量 #
- # \\eval{脚本} :运行脚本 #
- # \\bold :字体加粗,插入多一次关闭 #
- # \\italic :字体打斜,插入多一次关闭 #
- # \\f[字体名称] :更改字体 #
- # \\s[号码] :更改字体大小 #
- # \\p[名称] :插入图片 #
- # \\icon[名称] :插入图标 #
- # #
- #==============================================================================#
- class Game_Mission
- attr_accessor :mission
- attr_accessor :info
- attr_accessor :doned
- def initialize
- @mission = ["没有任务"]
- @info = ["\\a[1]\\c[2]\\s[50]\\f[楷体]没有任何的任务"]
- @doned = []
- end
- def get(mission,info)
- unless @mission.include?(mission)
- @mission.push(mission)
- @info.push(info)
- delete("没有任务") if @mission.include?("没有任务")
- end
- end
- def done(done_mission)
- for i in [email][email protected][/email]
- if @mission[i] == done_mission
- @doned.delete(i) if @doned.include?(i)
- @doned.push(i)
- end
- end
- end
- def delete(delete_mission)
- for i in [email][email protected][/email]
- if @mission[i] == delete_mission
- @mission.delete(delete_mission)
- delete_info = @info[i]
- @info.delete(delete_info)
- @doned.delete(i) if @doned.include?(i)
- end
- end
- $game_mission = Game_Mission.new if @mission.size == 0
- end
- def done_all
- for i in [email][email protected][/email]
- @doned.delete(i) if @doned.include?(i)
- @doned.push(i)
- end
- end
- def delete_all
- $game_mission = Game_Mission.new
- end
- end
- class Window_Mission < Window_Selectable
- def initialize
- super(0, 64, 200, 416)
- self.index = 0
- @item_max = $game_party.mission.mission.size
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- for i in 0...$game_party.mission.mission.size
- if $game_party.mission.doned.include?(i)
- self.contents.font.color = disabled_color
- text = $game_party.mission.mission[i] + "(√)"
- else
- self.contents.font.color = normal_color
- text = $game_party.mission.mission[i]
- end
- self.contents.draw_text(4, i * 32, 160, 32, text.to_s)
- end
- end
- end
- class Window_Info < Window_Base
- def initialize
- super(200,64,440,416)
- self.contents = Bitmap.new(408, 384)
- end
- def refresh(str)
- self.contents = Bitmap.new(408, 384) if self.contents == nil
- self.contents.clear
- y = 0
- align = 0
- begin
- last_text = str.clone
- str.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
- str.gsub!(/\\[Gg]/) { $game_party.gold.to_s }
- str.gsub!(/\\[Ii][Tt][Mm]\[(\d+)\]/) { $game_party.item_number($1.to_i) }
- str.gsub!(/\\[Ww][Pp][Nn]\[(\d+)\]/) { $game_party.weapon_number($1.to_i) }
- str.gsub!(/\\[Aa][Mm][Rr]\[(\d+)\]/) { $game_party.armor_number($1.to_i) }
- str.gsub!(/\\[Ee][Vv][Aa][Ll]{(.+)}/) { eval($1) }
- end until str == last_text
- str.gsub!(/\\[Nn]\[([0-9]+)\]/) do
- $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- lines = str.split("\n")
- for line in lines
- bitmap,align = bitmap_line(line,align)
- w = bitmap.width
- h = bitmap.height
- case align
- when 0
- x = 4
- when 1
- x = 204 - w / 2
- when 2
- x = 404 - w
- end
- self.contents.blt(x,y,bitmap,Rect.new(0,0,w,h))
- y += h
- end
- end
- def bitmap_line(str,old_align)
- w,h = get_wh(str.clone)
- w = 1 if w == 0
- bitmap = Bitmap.new(w,h)
- text = str
- align = old_align
- x = 0
- text.gsub!(/\\\\/) { "\000" }
- text.gsub!(/\\[Aa]\[(\d+)\]/){
- align = $1.to_i
- ""
- }
- text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
- text.gsub!(/\\[Bb][Oo][Ll][Dd]/) { "\002" }
- text.gsub!(/\\[Ii][Tt][Aa][Ll][Ii][Cc]/) { "\003" }
- text.gsub!(/\\[Ff]\[(\w+)\]/) { "\004[#{$1}]" }
- text.gsub!(/\\[Bb][Dd]\[(\w+)\]/) { "\005[#{$1}]" }
- text.gsub!(/\\[Ss]\[(\d+)\]/) { "\006[#{$1}]" }
- text.gsub!(/\\[Pp]\[(\w+)\]/) { "\007[#{$1}]" }
- text.gsub!(/\\[Ii][Cc][Oo][Nn]\[(\w+)\]/){ "\201[#{$1}]" }
- while ((c = text.slice!(/./m)) != nil)
- if c == "\000"
- c = "\\"
- end
- if c == "\001"
- text.sub!(/\[([0-9]+)\]/, "")
- color = $1.to_i
- if color >= 0 and color <= 9
- bitmap.font.color = text_color(color)
- elsif color == 8
- bitmap.font.color = disabled_color
- elsif color == 9
- bitmap.font.color = system_color
- end
- next
- end
- if c == "\002"
- bitmap.font.bold = bitmap.font.bold ? false : true
- next
- end
- if c == "\003"
- bitmap.font.italic = bitmap.font.italic ? false : true
- next
- end
- if c == "\004"
- text.sub!(/\[(\w+)\]/,"")
- bitmap.font.name = $1
- next
- end
- if c == "\005"
- text.sub!(/\[(\w+)\]/,"")
- color = bitmap.font.color.clone
- w = bitmap.text_size($1).width
- bitmap.font.color = Color.new(0,0,0,255)
- bitmap.draw_text((4 + x)-1, y-1, w, 32, $1)
- bitmap.draw_text((4 + x)-1, y+1, w, 32, $1)
- bitmap.draw_text((4 + x)+1, y-1, w, 32, $1)
- bitmap.draw_text((4 + x)+1, y+1, w, 32, $1)
- bitmap.font.color = color
- bitmap.draw_text(4 + x, y, w, 32, $1)
- x += bitmap.text_size($1).width
- next
- end
- if c == "\006"
- text.sub!(/\[(\d+)\]/,"")
- bitmap.font.size = $1.to_i
- next
- end
- if c == "\007"
- text.sub!(/\[(\w+)\]/,"")
- pic = RPG::Cache.picture($1)
- r = Rect.new(0,0,pic.width,pic.height)
- y = h / 2 - pic.height / 2
- bitmap.blt(x+2,y,pic,r)
- x += pic.width + 4
- next
- end
- if c == "\201"
- text.sub!(/\[(\w+)\]/,"")
- pic = RPG::Cache.icon($1)
- r = Rect.new(0,0,pic.width,pic.height)
- y = h / 2 - pic.height / 2
- bitmap.blt(x+2,y,pic,r)
- x += pic.width + 4
- next
- end
- bitmap.draw_text(x,0,w,h,c)
- x += bitmap.text_size(c).width
- end
- return bitmap.clone,align
- end
- def get_wh(str)
- bitmap = Bitmap.new(160,160)
- w = 0
- h = 32
- text = str
- text.gsub!(/\\\\/) { "\000" }
- text.gsub!(/\\[Aa]\[(\d+)\]/) { "" }
- text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "" }
- text.gsub!(/\\[Bb][Oo][Ll][Dd]/) { "" }
- text.gsub!(/\\[Ii][Tt][Aa][Ll][Ii][Cc]/) { "" }
- text.gsub!(/\\[Ff]\[(\w+)\]/) { "\001[#{$1}]" }
- text.gsub!(/\\[Bb][Dd]\[(\w+)\]/) { $1 }
- text.gsub!(/\\[Ss]\[(\d+)\]/) { "\002[#{$1}]" }
- text.gsub!(/\\[Pp]\[(\w+)\]/) { "\003[#{$1}]" }
- text.gsub!(/\\[Ii][Cc][Oo][Nn]\[(\w+)\]/) { "\004[#{$1}]" }
- while ((c = text.slice!(/./m)) != nil)
- if c == "\000"
- c = "\\"
- end
- if c == "\001"
- text.sub!(/\[(\w+)]/,"")
- bitmap.font.name = $1
- next
- end
- if c == "\002"
- text.sub!(/\[(\d+)]/,"")
- bitmap.font.size = $1.to_i
- next
- end
- if c == "\003"
- text.sub!(/\[(\w+)\]/,"")
- w += RPG::Cache.picture($1).width+4
- h = RPG::Cache.picture($1).height if RPG::Cache.picture($1).height > 32 and RPG::Cache.picture($1).height > h
- next
- end
- if c == "\004"
- text.sub!(/\[(\w+)\]/,"")
- w += RPG::Cache.icon($1).width+4
- h = RPG::Cache.icon($1).height if RPG::Cache.icon($1).height > 32 and RPG::Cache.icon($1).height > h
- next
- end
- w += bitmap.text_size(c).width
- h = bitmap.text_size(c).height if bitmap.text_size(c).height > 32 and bitmap.text_size(c).height > h
- end
- return w,h
- end
- end
- class Scene_Mission
- def main
- @window1 = Window_Base.new(0,0,200,64)
- @window1.contents = Bitmap.new(168,32)
- @window1.contents.draw_text(0,0,168,32,"任务",1)
- @window2 = Window_Base.new(200,0,440,64)
- @window2.contents = Bitmap.new(408,32)
- @window2.contents.draw_text(0,0,408,32,"任务说明",1)
- @mission_window = Window_Mission.new
- @mission_window.index = $game_party.mission.mission.size - 1
- @info_window = Window_Info.new
- info = $game_party.mission.info[@mission_window.index].clone
- @info_window.refresh(info)
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @window1.dispose
- @window2.dispose
- @mission_window.dispose
- @info_window.dispose
- end
- def update
- @mission_window.update
- @info_window.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- if Input.repeat?(Input::UP) or
- Input.repeat?(Input::DOWN)
- info = $game_party.mission.info[@mission_window.index].clone
- @info_window.refresh(info)
- end
- end
- end
- class Game_Party
- attr_accessor :mission
- alias orig_init initialize
- def initialize
- @mission = Game_Mission.new
- orig_init
- end
- end
- 还把Scene_Map给变换了
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成活动块
- @spriteset = Spriteset_Map.new
- # 生成信息窗口
- @message_window = Window_Message.new
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放活动块
- @spriteset.dispose
- # 释放信息窗口
- @message_window.dispose
- # 标题画面切换中的情况下
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 循环
- loop do
- # 按照地图、实例、主角的顺序刷新
- # (本更新顺序不会在满足事件的执行条件下成为给予角色瞬间移动
- # 的机会的重要因素)
- $game_map.update
- $game_system.map_interpreter.update
- $game_player.update
- # 系统 (计时器)、画面刷新
- $game_system.update
- $game_screen.update
- # 如果主角在场所移动中就中断循环
- unless $game_temp.player_transferring
- break
- end
- # 执行场所移动
- transfer_player
- # 处理过渡中的情况下、中断循环
- if $game_temp.transition_processing
- break
- end
- end
- # 刷新活动块
- @spriteset.update
- # 刷新信息窗口
- @message_window.update
- # 游戏结束的情况下
- if $game_temp.gameover
- # 切换的游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 返回标题画面的情况下
- if $game_temp.to_title
- # 切换到标题画面
- $scene = Scene_Title.new
- return
- end
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除过渡处理中标志
- $game_temp.transition_processing = false
- # 执行过渡
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- return
- end
- # 遇敌计数为 0 且、且遇敌列表不为空的情况下
- if $game_player.encounter_count == 0 and $game_map.encounter_list != []
- # 不是在事件执行中或者禁止遇敌中
- unless $game_system.map_interpreter.running? or
- $game_system.encounter_disabled
- # 确定队伍
- n = rand($game_map.encounter_list.size)
- troop_id = $game_map.encounter_list[n]
- # 队伍有效的话
- if $data_troops[troop_id] != nil
- # 设置调用战斗标志
- $game_temp.battle_calling = true
- $game_temp.battle_troop_id = troop_id
- $game_temp.battle_can_escape = true
- $game_temp.battle_can_lose = false
- $game_temp.battle_proc = nil
- end
- end
- end
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 不是在事件执行中或菜单禁止中
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- # 设置菜单调用标志以及 SE 演奏
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- end
- end
- # 调试模式为 ON 并且按下 F9 键的情况下
- if $DEBUG and Input.press?(Input::F9)
- # 设置调用调试标志
- $game_temp.debug_calling = true
- end
- # 不在主角移动中的情况下
- unless $game_player.moving?
- # 执行各种画面的调用
- if $game_temp.battle_calling
- call_battle
- elsif $game_temp.shop_calling
- call_shop
- elsif $game_temp.name_calling
- call_name
- elsif $game_temp.menu_calling
- call_menu
- elsif $game_temp.save_calling
- call_save
- elsif $game_temp.debug_calling
- call_debug
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 调用战斗
- #--------------------------------------------------------------------------
- def call_battle
- # 清除战斗调用标志
- $game_temp.battle_calling = false
- # 清除菜单调用标志
- $game_temp.menu_calling = false
- $game_temp.menu_beep = false
- # 生成遇敌计数
- $game_player.make_encounter_count
- # 记忆地图 BGM 、停止 BGM
- $game_temp.map_bgm = $game_system.playing_bgm
- $game_system.bgm_stop
- # 演奏战斗开始 SE
- $game_system.se_play($data_system.battle_start_se)
- # 演奏战斗 BGM
- $game_system.bgm_play($game_system.battle_bgm)
- # 矫正主角姿势
- $game_player.straighten
- # 切换到战斗画面
- $scene = Scene_Battle.new
- end
- #--------------------------------------------------------------------------
- # ● 调用商店
- #--------------------------------------------------------------------------
- def call_shop
- # 清除商店调用标志
- $game_temp.shop_calling = false
- # 矫正主角姿势
- $game_player.straighten
- # 切换到商店画面
- $scene = Scene_Shop.new
- end
- #--------------------------------------------------------------------------
- # ● 调用名称输入
- #--------------------------------------------------------------------------
- def call_name
- # 清除调用名称输入标志
- $game_temp.name_calling = false
- # 矫正主角姿势
- $game_player.straighten
- # 切换到名称输入画面
- $scene = Scene_Name.new
- end
- #--------------------------------------------------------------------------
- # ● 调用菜单
- #--------------------------------------------------------------------------
- def call_menu
- # 清除菜单调用标志
- $game_temp.menu_calling = false
- # 已经设置了菜单 SE 演奏标志的情况下
- if $game_temp.menu_beep
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 清除菜单演奏 SE 标志
- $game_temp.menu_beep = false
- end
- # 矫正主角姿势
- $game_player.straighten
- # 切换到菜单画面
- $scene = Scene_Menu.new
- end
- #--------------------------------------------------------------------------
- # ● 调用存档
- #--------------------------------------------------------------------------
- def call_save
- # 矫正主角姿势
- $game_player.straighten
- # 切换到存档画面
- $scene = Scene_Save.new
- end
- #--------------------------------------------------------------------------
- # ● 调用调试
- #--------------------------------------------------------------------------
- def call_debug
- # 清除调用调试标志
- $game_temp.debug_calling = false
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 矫正主角姿势
- $game_player.straighten
- # 切换到调试画面
- $scene = Scene_Debug.new
- end
- #--------------------------------------------------------------------------
- # ● 主角的场所移动
- #--------------------------------------------------------------------------
- def transfer_player
- # 清除主角场所移动调试标志
- $game_temp.player_transferring = false
- # 移动目标与现在的地图有差异的情况下
- if $game_map.map_id != $game_temp.player_new_map_id
- # 设置新地图
- $game_map.setup($game_temp.player_new_map_id)
- end
- # 设置主角位置
- $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
- # 设置主角朝向
- case $game_temp.player_new_direction
- when 2 # 下
- $game_player.turn_down
- when 4 # 左
- $game_player.turn_left
- when 6 # 右
- $game_player.turn_right
- when 8 # 上
- $game_player.turn_up
- end
- # 矫正主角姿势
- $game_player.straighten
- # 刷新地图 (执行并行事件)
- $game_map.update
- # 在生成活动块
- @spriteset.dispose
- @spriteset = Spriteset_Map.new
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除过渡处理中标志
- $game_temp.transition_processing = false
- # 执行过渡
- Graphics.transition(20)
- end
- # 执行地图设置的 BGM、BGS 的自动切换
- $game_map.autoplay
- # 设置画面
- Graphics.frame_reset
- # 刷新输入信息
- Input.update
- end
- end
复制代码 求解决!
我比较笨,最好有教程。 |
|