赞 | 1 |
VIP | 17 |
好人卡 | 3 |
积分 | 1 |
经验 | 49919 |
最后登录 | 2020-2-6 |
在线时间 | 898 小时 |
Lv1.梦旅人 矿工
- 梦石
- 0
- 星屑
- 134
- 在线时间
- 898 小时
- 注册时间
- 2012-10-5
- 帖子
- 1535
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
由于数组的附加码搞不懂,所以总是说脚本“Window_Task”124行“[]”出现NoMethodError。
但是这本来就是对的呀!
好吧,贴原脚本:- #==============================================================================
- # ■ 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 :tasks # 已有的任务个数
- 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
- @tasks = 0
- @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
- @tasks += 1
- # 保存数据(载入数组)
- if $task_name == nil
- $task_name = [@new_task_name]
- $task_command_name = [@new_task_name]
- $task_help = [@new_task_help]
- $task_gold = [@new_task_gold]
- $task_items = [@new_task_items]
- $task_weapons = [@new_task_weapons]
- $task_armors = [@new_task_armors]
- $task_item_num = [@new_task_item_num]
- $task_weapon_num = [@new_task_weapon_num]
- $task_armor_num = [@new_task_armor_num]
- $task_difficulty = [@new_task_difficulty]
- else
- $task_name[@tasks] = @new_task_name
- $task_command_name[@tasks] = @new_task_name
- $task_help[@tasks] = @new_task_help
- $task_gold[@tasks] = @new_task_gold
- $task_items[@tasks] = @new_task_items
- $task_weapons[@tasks] = @new_task_weapons
- $task_armors[@tasks] = @new_task_armors
- $task_item_num[@tasks] = @new_task_item_num
- $task_weapon_num[@tasks] = @new_task_weapon_num
- $task_armor_num[@tasks] = @new_task_armor_num
- $task_difficulty[@tasks] = @new_task_difficulty
- end
- end
- #--------------------------------------------------------------------------
- # ● 完成任务(在Scene_Task的内部使用)
- #--------------------------------------------------------------------------
- def final_task(id)
- # 如果任务没有失败
- unless $task_name.include?("(已失败)")
- # 算出数组中的id
- id = id - 1
- # 修改数组数据
- $task_command_name[id] = $task_command_name[id] + "(已完成)"
- $task_help[id] = $task_help[id] + "(已完成)"
- # 获得任务奖励
- unless $task_gold[id] == 0
- $game_party.gain_gold($task_gold[id])
- end
- unless $task_items[id] == nil
- $game_party.gain_item($task_items[id], $task_item_num[@tasks])
- end
- unless $task_weapons[id] == nil
- $game_party.gain_weapon($task_weapons[id], $task_weapon_num[@tasks])
- end
- unless $task_armors[id] == nil
- $game_party.gain_armor($task_armors[id], $task_armor_num[@tasks])
- end
- end
- end
- #------------------------------------------------------------------------
- # 失败任务(啊啊啊!)
- #------------------------------------------------------------------------
- def lose_task(id)
- unless $task_name.include?("(已完成)")
- $task_command_name[id] = $task_command_name[id] + "(已失败)"
- $task_help[id] = $task_help[id] + "(已失败)"
- end
- end
- end
复制代码- #==============================================================================
- # ■ Window_Task
- #------------------------------------------------------------------------------
- # 显示任务的选择行窗口。
- #==============================================================================
- class Window_Task < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 480 - 64)
- if $game_temp.tasks == 0
- @item_max = 1
- else
- @item_max = $game_temp.tasks
- end
- difficulty = nil
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if $game_temp.tasks == 0
- @item_max = 1
- else
- @item_max = $game_temp.tasks
- 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))
- self.contents.draw_text(rect, $task_name[index])
- 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 * 56, 320 - 8, 32)
- end
- end
- #--------------------------------------------------------------------------
- # ● 拆分数组并显示内容
- #--------------------------------------------------------------------------
- def update
- super
- for i in 0...@item_max
- x = 320 + 16
- if self.index == i and $t == true and $task_command_name[self.index] == ""
- $f = false
- refresh
- 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 $task_gold[self.index] != 0
- self.contents.draw_text(x, 176, 100, 32, "奖励金钱:")
- y = 240
- else
- y = 208
- end
- if $task_items[self.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, $task_name[index])
- self.contents.draw_text(x, 144, 280, 32, $task_help[index])
- if $task_gold[self.index] != 0
- self.contents.draw_text(x, 208, 100, 32, $task_gold[index])
- end
- if $task_items[self.index] != nil
- draw_item_name($data_items[$task_items[index]], x, y + 32)
- end
- if $task_weapons[self.index] != nil
- draw_item_name($data_weapons[$task_weapons[index]], x, y + 64)
- end
- if $task_armors[self.index] != nil
- draw_item_name($data_armors[$task_armors[index]], x, y + 96)
- end
- #Moon = difficulty[self.index] / DIFFICULTY::System
- #Star = difficulty[self.index] % DIFFICULTY::System
- #Sun = Moon / DIFFICULTY::System
- #Moon %= DIFFICULTY::System
- #Space = DIFFICULTY::Space
- #rect = Rect.new(0, 0, DIFFICULTY::Size, DIFFICULTY::Size)
- #while Sun>0
- # self.contents.blt(x + Space, 96, Sun, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Sun -= 1
- #end
- #while Moon>0
- # self.contents.blt(x + Space, 97, Moon, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Moon -= 1
- #end
- #while Star>0
- # self.contents.blt(x + Space, 98, Star, rect)
- # Space += DIFFICULTY::Size + DIFFICULTY::Space;Star -= 1
- #end
- text1 = "★" * $task_difficulty[self.index]
- text2 = "☆" * (5 - $task_difficulty[index])
- text = text1 + text2
- self.contents.draw_text(x + 60, 64, 280, 32, text)
- end
- end
- if $task_command_name[self.index] == ""
- $f = true
- end
- end
- end
复制代码 数组载入单元时用什么括号? |
|