赞 | 1 |
VIP | 17 |
好人卡 | 3 |
积分 | 1 |
经验 | 49919 |
最后登录 | 2020-2-6 |
在线时间 | 898 小时 |
Lv1.梦旅人 矿工
- 梦石
- 0
- 星屑
- 134
- 在线时间
- 898 小时
- 注册时间
- 2012-10-5
- 帖子
- 1535
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
一个游戏没有商店是不能运行的。好吧,直接上图。
↑这个是任务系统↑
↑这个是商店报错图像↑
我没有改商店任何东西!
好吧,任务系统脚本:- #==============================================================================
- # ■ Game_Temp
- #------------------------------------------------------------------------------
- # 在没有存档的情况下,处理临时数据的类。这个类的实例请参考
- # $game_temp 。
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :map_bgm # 地图画面 BGM (战斗时记忆用)
- attr_accessor :message_text # 信息文章
- attr_accessor :message_proc # 信息 返回调用 (Proc)
- attr_accessor :choice_start # 选择项 开始行
- attr_accessor :choice_max # 选择项 项目数
- attr_accessor :choice_cancel_type # 选择项 取消的情况
- attr_accessor :choice_proc # 选择项 返回调用 (Proc)
- attr_accessor :num_input_start # 输入数值 开始行
- attr_accessor :num_input_variable_id # 输入数值 变量 ID
- attr_accessor :num_input_digits_max # 输入数值 位数
- attr_accessor :message_window_showing # 显示信息窗口
- attr_accessor :common_event_id # 公共事件 ID
- attr_accessor :in_battle # 战斗中的标志
- attr_accessor :battle_calling # 调用战斗的标志
- attr_accessor :battle_troop_id # 战斗 队伍 ID
- attr_accessor :battle_can_escape # 战斗中 允许逃跑 ID
- attr_accessor :battle_can_lose # 战斗中 允许失败 ID
- attr_accessor :battle_proc # 战斗 返回调用 (Proc)
- attr_accessor :battle_turn # 战斗 回合数
- attr_accessor :battle_event_flags # 战斗 事件执行执行完毕的标志
- attr_accessor :battle_abort # 战斗 中断标志
- attr_accessor :battle_main_phase # 战斗 状态标志
- attr_accessor :battleback_name # 战斗背景 文件名
- attr_accessor :forcing_battler # 强制行动的战斗者
- attr_accessor :shop_calling # 调用商店的标志
- attr_accessor :shop_goods # 商店 商品列表
- attr_accessor :name_calling # 输入名称 调用标志
- attr_accessor :name_actor_id # 输入名称 角色 ID
- attr_accessor :name_max_char # 输入名称 最大字数
- attr_accessor :menu_calling # 菜单 调用标志
- attr_accessor :menu_beep # 菜单 SE 演奏标志
- attr_accessor :save_calling # 存档 调用标志
- attr_accessor :debug_calling # 调试 调用标志
- attr_accessor :player_transferring # 主角 场所移动标志
- attr_accessor :player_new_map_id # 主角 移动目标地图 ID
- attr_accessor :player_new_x # 主角 移动目标 X 坐标
- attr_accessor :player_new_y # 主角 移动目标 Y 坐标
- attr_accessor :player_new_direction # 主角 移动目标 朝向
- attr_accessor :transition_processing # 过渡处理中标志
- attr_accessor :transition_name # 过渡 文件名
- attr_accessor :gameover # 游戏结束标志
- attr_accessor :to_title # 返回标题画面标志
- attr_accessor :last_file_index # 最后存档的文件编号
- attr_accessor :debug_top_row # 调试画面 保存状态用
- attr_accessor :debug_index # 调试画面 保存状态用
- attr_accessor :new_task_name # 新任务 名称
- attr_accessor :new_task_help # 新任务 帮助文字
- attr_accessor :new_task_gold # 新任务 奖励金钱
- attr_accessor :new_task_items # 新任务 奖励物品
- attr_accessor :new_task_weapons # 新任务 奖励武器
- attr_accessor :new_task_armors # 新任务 奖励防具
- attr_accessor :new_task_item_num # 新任务 物品奖励数量
- attr_accessor :new_task_weapon_num # 新任务 武器奖励数量
- attr_accessor :new_task_armor_num # 新任务 防具奖励数量
- attr_accessor :new_task_difficulty
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @map_bgm = nil
- @message_text = nil
- @message_proc = nil
- @choice_start = 99
- @choice_max = 0
- @choice_cancel_type = 0
- @choice_proc = nil
- @num_input_start = 99
- @num_input_variable_id = 0
- @num_input_digits_max = 0
- @message_window_showing = false
- @common_event_id = 0
- @in_battle = false
- @battle_calling = false
- @battle_troop_id = 0
- @battle_can_escape = false
- @battle_can_lose = false
- @battle_proc = nil
- @battle_turn = 0
- @battle_event_flags = {}
- @battle_abort = false
- @battle_main_phase = false
- @battleback_name = ''
- @forcing_battler = nil
- @shop_calling = false
- @shop_id = 0
- @name_calling = false
- @name_actor_id = 0
- @name_max_char = 0
- @menu_calling = false
- @menu_beep = false
- @save_calling = false
- @debug_calling = false
- @player_transferring = false
- @player_new_map_id = 0
- @player_new_x = 0
- @player_new_y = 0
- @player_new_direction = 0
- @transition_processing = false
- @transition_name = ""
- @gameover = false
- @to_title = false
- @last_file_index = 0
- @debug_top_row = 0
- @debug_index = 0
- @new_task_name = ""
- @new_task_help = ""
- @new_task_gold = ""
- @new_task_items = nil
- @new_task_weapons = nil
- @new_task_armors = nil
- @new_task_item_num = 0
- @new_task_weapon_num = 0
- @new_task_armor_num = 0
- @new_task_difficulty = 1
- end
- #--------------------------------------------------------------------------
- # ● 生成新任务(在Scene_Task的内部使用)
- #--------------------------------------------------------------------------
- def new_task(name, help, difficulty = 1, gold = 0, items = nil, weapons = nil, armors = nil, item_num = 1, weapon_num = 1, armor_num = 1)
- # 实例变量的改变
- @new_task_name = name
- @new_task_help = help
- @new_task_gold = gold
- @new_task_items = items
- @new_task_weapons = weapons
- @new_task_armors = armors
- @new_task_item_num = item_num
- @new_task_weapon_num = weapon_num
- @new_task_armor_num = armor_num
- @new_task_difficulty = difficulty
- $game_taskdata.tasks += 1
- # 保存数据(载入数组)
- if $game_taskdata.task_name[0] == ""
- $game_taskdata.task_name = [@new_task_name]
- $game_taskdata.task_command_name = [@new_task_name]
- $game_taskdata.task_help = [@new_task_help]
- $game_taskdata.task_gold = [@new_task_gold]
- $game_taskdata.task_items = [@new_task_items]
- $game_taskdata.task_weapons = [@new_task_weapons]
- $game_taskdata.task_armors = [@new_task_armors]
- $game_taskdata.task_item_num = [@new_task_item_num]
- $game_taskdata.task_weapon_num = [@new_task_weapon_num]
- $game_taskdata.task_armor_num = [@new_task_armor_num]
- $game_taskdata.task_difficulty = [@new_task_difficulty]
- else
- $game_taskdata.task_name.push(@new_task_name)
- $game_taskdata.task_command_name.push(@new_task_name)
- $game_taskdata.task_help.push(@new_task_help)
- $game_taskdata.task_gold.push(@new_task_gold)
- $game_taskdata.task_items.push(@new_task_items)
- $game_taskdata.task_weapons.push(@new_task_weapons)
- $game_taskdata.task_armors.push(@new_task_armors)
- $game_taskdata.task_item_num.push(@new_task_item_num)
- $game_taskdata.task_weapon_num.push(@new_task_weapon_num)
- $game_taskdata.task_armor_num.push(@new_task_armor_num)
- $game_taskdata.task_difficulty.push(@new_task_difficulty)
- end
- end
- #--------------------------------------------------------------------------
- # ● 完成任务(在Scene_Task的内部使用)
- #--------------------------------------------------------------------------
- def final_task(id)
- # 算出数组中的id
- id = id - 1
- # 修改数组数据
- $game_taskdata.task_command_name[id] = $game_taskdata.task_command_name[id] + "(已完成)"
- $game_taskdata.task_help[id] = $game_taskdata.task_help[id] + "\n(已完成)"
- # 获得任务奖励
- unless $game_taskdata.task_gold[id] == 0
- $game_party.gain_gold($game_taskdata.task_gold[id])
- end
- unless $game_taskdata.task_items[id] == nil
- $game_party.gain_item($game_taskdata.task_items[id], $game_taskdata.task_item_num[id])
- end
- unless $game_taskdata.task_weapons[id] == nil
- $game_party.gain_weapon($game_taskdata.task_weapons[id], $game_taskdata.task_weapon_num[id])
- end
- unless $game_taskdata.task_armors[id] == nil
- $game_party.gain_armor($game_taskdata.task_armors[id], $game_taskdata.task_weapon_num[id])
- end
- end
- #------------------------------------------------------------------------
- # 失败任务(啊啊啊!)
- #------------------------------------------------------------------------
- def lose_task(id)
- $game_taskdata.task_command_name[id] = $game_taskdata.task_command_name[id] + "(已失败)"
- $game_taskdata.task_help[id] = $game_taskdata.task_help[id] + "\n(已失败)"
- end
- end
复制代码- #==============================================================================
- # ■ Window_Task
- #------------------------------------------------------------------------------
- # 显示任务的选择行窗口。
- #==============================================================================
- class Window_Task < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 480 - 64)
- if $game_taskdata.tasks == 0
- @item_max = 1
- else
- @item_max = $game_taskdata.tasks
- end
- difficulty = nil
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if $game_taskdata.tasks == 0
- @item_max = 1
- else
- @item_max = $game_taskdata.tasks
- end
- if $game_taskdata.task_command_name[0] == ""
- $f = true
- else
- $f = false
- end
- for i in 0...@item_max
- draw_item(i,normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index,color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, 640 / 2 - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- for i in 0...@item_max
- self.contents.draw_text(rect, $game_taskdata.task_command_name[index])#ndex
- end
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 32, 320 - 8, 32)
- end
- end
- #--------------------------------------------------------------------------
- # ● 拆分数组并显示内容
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- for i in 0...@item_max
- x = 320 + 16
- if self.index == i and $t == true and $game_taskdata.task_command_name[index] != ""
- self.contents.font.color = system_color
- self.contents.draw_text(x, 0, 100, 32, "任务名:")
- self.contents.draw_text(x, 64, 100, 32, "难度:")
- self.contents.draw_text(x, 112, 100, 32, "说明:")
- if $game_taskdata.task_gold[index] != 0
- self.contents.draw_text(x, 208, 100, 32, "奖励金钱:")
- y = 272
- else
- y = 240
- end
- if $game_taskdata.task_items[index] != nil
- self.contents.draw_text(x, y, 100, 32, "奖励物品:")
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(x, 32, 320 - 32, 32, $game_taskdata.task_name[index])
- self.contents.draw_text(x, 144, 288, 32, $game_taskdata.task_help[index])
- if $game_taskdata.task_gold[index] != 0
- self.contents.draw_text(x, 208, 100, 32, $game_taskdata.task_gold[index])
- end
- if $game_taskdata.task_items[index] != nil
- draw_item_name($data_items[$game_taskdata.task_items[index]], x, y + 32)
- self.contents.draw_text(x + 100, y + 32, 280, 32, " × " + $game_taskdata.task_item_num[index].to_s)
- end
- if $game_taskdata.task_weapons[index] != nil
- draw_item_name($data_weapons[$game_taskdata.task_weapons[index]], x, y + 64)
- self.contents.draw_text(x + 100, y + 32, 280, 32, " × " + $game_taskdata.task_weapon_num[index].to_s)
- end
- if $game_taskdata.task_armors[index] != nil
- draw_item_name($data_armors[$game_taskdata.task_armors[index]], x, y + 96)
- self.contents.draw_text(x + 100, y + 32, 280, 32, " × " + $game_taskdata.task_armor_num[index].to_s)
- end
- text1 = "★" * $game_taskdata.task_difficulty[index]
- text2 = "☆" * (5 - $game_taskdata.task_difficulty[index])
- text = text1 + text2
- self.contents.draw_text(x + 60, 64, 280, 32, text)
- end
- end
- # 解除任务信息
- if $t == true
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- $t = false
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- end
- if Input.trigger?(Input::UP)
- $t = false
- $game_system.se_play($data_system.cursor_se)
- end
- if Input.trigger?(Input::DOWN)
- $t = false
- $game_system.se_play($data_system.cursor_se)
- end
- end
- if $t == false
- refresh
- end
- end
- end
复制代码- #===============================================================================
- # ● Scene_Task
- #-------------------------------------------------------------------------------
- # 处理任务画面的类。
- #===============================================================================
- class Scene_Task
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成任务活动窗口
- @task_window = Window_Task.new
- @task_window.y = 64
- if @task_window.active == false
- @task_window.active = true
- end
- # 生成任务辅助窗口
- @taskassist_window = Window_TaskAssist.new
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放各个窗口
- @task_window.dispose
- @taskassist_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新各个窗口
- @task_window.update
- @taskassist_window.update
- # 解除任务信息
- if $t == true
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- $t = false
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- end
- if Input.trigger?(Input::UP)
- $t = false
- $game_system.se_play($data_system.cursor_se)
- end
- if Input.trigger?(Input::DOWN)
- $t = false
- $game_system.se_play($data_system.cursor_se)
- end
- end
- if $game_taskdata.tasks != 0
- $f = false
- end
- # 当按下 C 键后可查看任务信息
- if Input.trigger?(Input::C) and $game_taskdata.tasks != 0
- $t = true #让T变为true
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- end
- # 没显示任务时按下 B 键的情况下
- if $t == false and Input.trigger?(Input::B)
- # 切换到菜单界面
- $scene = Scene_Menu.new(5)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- end
- if $f == true
- if Input.trigger?(Input::C)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
- if Input.trigger?(Input::B)
- # 切换到菜单界面
- $scene = Scene_Menu.new(5)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- end
- end
- end
- end
复制代码 是不是某一项与商店冲突了? |
|