赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 10 |
经验 | 26165 |
最后登录 | 2024-11-2 |
在线时间 | 303 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 975
- 在线时间
- 303 小时
- 注册时间
- 2013-10-13
- 帖子
- 60
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 wly611341 于 2014-1-2 00:01 编辑
我用的战斗系统是ARPG系统 v1.0 ,因为这个脚本是从别的游戏中拷贝出来的,所以他多多少少带了些东西,其中就包括了地图技能,援助技能和危机技能。
但是,这些技能在那个游戏中就可以使用,在我的游戏中就无法使用。也不知道是哪里出了错,求前辈们帮帮忙。不按技能键没事,一按就挂。
会弹出对话框"no implicit conversion from nil to integer"
出错的是这句’ check_event_skill($data_skills[SKILL_IN_MENU[$game_party.actors[1].id-1]], $game_party.actors[1])‘
就是下面代码的第160句
全代码如下- #==============================================================================
- # ■ Game_Player
- #------------------------------------------------------------------------------
- # 处理主角的类。事件启动的判定、以及地图的滚动等功能。
- # 本类的实例请参考 $game_player。
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 清除角色的文件名及对像
- @character_name = ""
- @character_hue = 0
- # 分支结束
- return
- end
- # 获取带头的角色
- actor = $game_party.actors[0]
- # 设置角色的文件名及对像
- @character_name = actor.character_name
- if $game_map.battle?
- @need_move_speed = 4 + $game_party.actors[0].agi / 80
- if @need_move_speed > 7
- @need_move_speed = 7
- end
- else
- @need_move_speed = 5
- end
- @character_hue = actor.character_hue
- # 初始化不透明度和合成方式子
- [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
- @blend_type = 0
- end
- #--------------------------------------------------------------------------
- # ● 画面更新
- #--------------------------------------------------------------------------
- def update
- # 本地变量记录移动信息
- last_moving = moving?
- # 移动中、事件执行中、强制移动路线中、
- # 信息窗口一个也不显示的时候
- unless moving? or $game_system.map_interpreter.running? or
- @move_route_forcing or $game_temp.message_window_showing or !$game_party.actors[0].movable?
- # 如果方向键被按下、主角就朝那个方向移动
- case Input.dir4
- when 2
- if @move_speed < @need_move_speed
- @move_speed += 1
- end
- move_down
- when 4
- if @move_speed < @need_move_speed
- @move_speed += 1
- end
- move_left
- when 6
- if @move_speed < @need_move_speed
- @move_speed += 1
- end
- move_right
- when 8
- if @move_speed < @need_move_speed
- @move_speed += 1
- end
- move_up
- end
- end
- # 本地变量记忆坐标
- last_real_x = @real_x
- last_real_y = @real_y
- super
- if Input.dir4 == 0
- @move_speed = 4
- end
- # 角色向下移动、画面上的位置在中央下方的情况下
- if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
- # 画面向下卷动
- $game_map.scroll_down(@real_y - last_real_y)
- end
- # 角色向左移动、画面上的位置在中央左方的情况下
- if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
- # 画面向左卷动
- $game_map.scroll_left(last_real_x - @real_x)
- end
- # 角色向右移动、画面上的位置在中央右方的情况下
- if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
- # 画面向右卷动
- $game_map.scroll_right(@real_x - last_real_x)
- end
- # 角色向上移动、画面上的位置在中央上方的情况下
- if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
- # 画面向上卷动
- $game_map.scroll_up(last_real_y - @real_y)
- end
- # 不在移动中的情况下
- unless moving?
- # 上次主角移动中的情况
- if last_moving
- # 与同位置的事件接触就判定为事件启动
- result = check_event_trigger_here([1,2])
- # 没有可以启动的事件的情况下
- if result == false
- # 调试模式为 ON 并且按下 CTRL 键的情况下除外
- unless $DEBUG and Input.press?(Input::CTRL)
- # 遇敌计数下降
- if @encounter_count > 0
- @encounter_count -= 1
- end
- end
- end
- end
- if @action_wait_count > 0
- @action_wait_count -= 1
- end
- if $game_map.battle?
- if Kboard.trigger?($R_Key_1)
- use_item($data_items[$game_party.set_items[0]])
- return
- end
- if Kboard.trigger?($R_Key_2)
- use_item($data_items[$game_party.set_items[1]])
- return
- end
- if Kboard.trigger?($R_Key_3)
- use_item($data_items[$game_party.set_items[2]])
- return
- end
- if Kboard.trigger?($R_Key_4)
- use_item($data_items[$game_party.set_items[3]])
- return
- end
- end
- # 以下为不能行动的状况
- unless $game_party.actors.size > 0 and $game_party.actors[0].movable?
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 判定为同位置以及正面的事件启动
- check_event_trigger_here([0])
- check_event_trigger_there([0,1,2])
- if $game_map.battle?
- check_event_attack
- end
- return
- end
- if Kboard.trigger?(MAP_SKILL_KEY)
- check_event_skill($data_skills[SKILL_IN_MAP[$game_party.actors[0].id-1]])
- return
- end
- if $game_map.battle?
- if $game_party.actors[0].hp <= $game_party.actors[0].maxhp / 5 and
- check_event_skill($data_skills[SKILL_IN_DANGER[$game_party.actors[0].id-1]])
- end
- if Kboard.trigger?(MENU_SKILL_KEY)
- check_event_skill($data_skills[SKILL_IN_MENU[$game_party.actors[1].id-1]], $game_party.actors[1])
- return
- end
- if Input.trigger?(Input::X)
- check_event_skill($data_skills[$game_party.actors[0].set_skills[0]])
- return
- end
- if Input.trigger?(Input::Y)
- check_event_skill($data_skills[$game_party.actors[0].set_skills[1]])
- return
- end
- if Input.trigger?(Input::Z)
- check_event_skill($data_skills[$game_party.actors[0].set_skills[2]])
- return
- end
- if Kboard.trigger?($R_Key_F)
- check_event_skill($data_skills[$game_party.actors[0].set_skills[3]])
- return
- end
- if Kboard.trigger?($R_Key_G)
- check_event_skill($data_skills[$game_party.actors[0].set_skills[4]])
- return
- end
- if Kboard.trigger?(JUMP_KEY) and @action_wait_count == 0
- dis = 4
- if $game_party.actors[0].id == 3
- dis = 6
- end
- case @direction
- when 2
- $game_player.jump(0,dis)
- when 4
- $game_player.jump(-dis,0)
- when 6
- $game_player.jump(dis,0)
- when 8
- $game_player.jump(0,-dis)
- end
- @action_wait_count = 45 - $game_party.actors[0].dex / 5 + BASE_ACTION_COUNT
- Audio.se_play(JUMP_SE)
- return
- end
- end
- end
- end
- #===========================================================================
- # 物品判定
- #===========================================================================
- def use_item(item)
- if item.id == 0 or item == nil
- return
- end
- # 如果物品用完的情况下
- if $game_party.item_number(item.id) == 0
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 目标是全体的情况下
- if item.scope == 4
- # 对同伴全体应用物品使用效果
- used = false
- for i in $game_party.actors
- used |= i.item_effect(item)
- end
- end
- # 目标是单体的情况下
- if item.scope == 3
- # 对目标角色应用物品的使用效果
- target = $game_party.actors[0]
- used = target.item_effect(item)
- end
- # 使用物品的情况下
- if used
- # 演奏物品使用时的 SE
- $game_system.se_play(item.menu_se)
- # 消耗品的情况下
- if item.consumable
- # 使用的物品数减 1
- $game_party.lose_item(item.id, 1)
- # 再描绘物品窗口的项目
- $skill_window_need_refresh = true
- end
- # 公共事件 ID 有效的情况下
- if item.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = item.common_event_id
- # 切换到地图画面
- return
- end
- end
- # 无法使用物品的情况下
- unless used
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- #===========================================================================
- # 技能判定
- #===========================================================================
- def check_event_skill(skill,actor = $game_party.actors[0])
- # 事件执行中的情况下
- if skill.id == 0 or skill == nil
- return
- end
- if $game_system.map_interpreter.running?
- return
- end
- unless actor.current_action.forcing
- # 因为 SP 耗尽而无法使用的情况下
- unless actor.skill_can_use?(skill.id)
- return
- end
- end
- if skill.scope == 1
- # 全部事件的循环
- for event in $game_map.events.values
- case @direction
- when 2
- attack_able = (event.y - @y > 0 and event.y - @y < skill.range and (@x - event.x).abs < 2)
- when 4
- attack_able = (@x - event.x > 0 and @x - event.x < skill.range and (@y - event.y).abs < 2)
- when 6
- attack_able = (event.x - @x > 0 and event.x - @x < skill.range and (@y - event.y).abs < 2)
- when 8
- attack_able = (@y - event.y > 0 and @y - event.y < skill.range and (@x - event.x).abs < 2)
- end
- if attack_able
- # 事件坐标与目标一致的情况下
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger? and event.enemy != nil and @action_wait_count <= 0
- if skill.animation1_id == 0
- self.white_flash = true
- else
- self.animation_id = skill.animation1_id
- end
- $game_variables[TARGET] = event.id
- event.damage = event.enemy.skill_effect(actor, skill) if event.enemy.id != 100
- event.damage_pop = event.enemy.id != 100
- event.animation_id = skill.animation2_id
- actor.sp -= skill.sp_cost
- if skill.cold.to_i != 0
- actor.cold[skill.id] = skill.cold.to_i
- end
- @action_wait_count = 45 - $game_party.actors[0].dex / 5 + BASE_ACTION_COUNT
- end
- end
- end
- end
- if skill.scope == 2
- ####============================
- range = skill.range
- ####============================
- # 全部事件的循环
- $target = []
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- # 事件坐标与目标一致的情况下
- sx = @x - event.x
- sy = @y - event.y
- # 求得差的绝对值
- abs_sx = sx > 0 ? sx : -sx
- abs_sy = sy > 0 ? sy : -sy
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger? and event.enemy != nil and @action_wait_count <= 0 and abs_sx + abs_sy < range and event.enemy.id != 100
- if skill.animation1_id == 0
- self.white_flash = true
- else
- self.animation_id = skill.animation1_id
- end
- $target.push(event.id)
- event.damage = event.enemy.skill_effect(actor, skill)
- event.damage_pop = true
- unless $data_animations[skill.animation2_id].position == 3
- event.animation_id = skill.animation2_id
- else
- event.animation_id = 102
- end
- end
- end
- if $target == []
- return
- end
- if $data_animations[skill.animation2_id].position == 3
- self.animation_id = skill.animation2_id
- end
- @action_wait_count = 45 - $game_party.actors[0].dex / 5 + BASE_ACTION_COUNT
- actor.sp -= skill.sp_cost
- if skill.cold.to_i != 0
- actor.cold[skill.id] = skill.cold.to_i
- end
- end
- if skill.scope == 3
- # 全部事件的循环
- # if $game_party.actors[0].hp == $game_party.actors[0].maxhp
- # return
- # end
- if skill.animation1_id == 0
- self.white_flash = true
- else
- self.animation_id = skill.animation1_id
- end
- self.damage = $game_party.actors[0].skill_effect(actor, skill)
- self.damage_pop = true
- self.animation_id = skill.animation2_id if skill.animation2_id != 0
- @action_wait_count = 45 - actor.dex / 5 + BASE_ACTION_COUNT
- actor.sp -= skill.sp_cost
- if skill.cold.to_i != 0
- actor.cold[skill.id] = skill.cold.to_i
- end
- end
- if skill.scope > 3 or skill.scope == 0
- if skill.animation1_id == 0
- self.white_flash = true
- else
- self.animation_id = skill.animation1_id
- end
- self.animation_id = skill.animation1_id
- @action_wait_count = 45 - $game_party.actors[0].dex / 5 + BASE_ACTION_COUNT
- actor.sp -= skill.sp_cost
- if skill.cold.to_i != 0
- actor.cold[skill.id] = skill.cold.to_i
- end
- end
- if skill.common_event_id > 0
- # 设置事件
- common_event = $data_common_events[skill.common_event_id]
- $game_system.map_interpreter.setup(common_event.list, 0)
- end
- $skill_window_need_refresh = true
- return# result
- end
- #===========================================================================
- # 攻击判定
- #===========================================================================
- def check_event_attack
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 全部事件的循环
- for event in $game_map.events.values
- # 武器射程判定
- attack_able = false
- # 全部事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- case @direction
- when 2
- attack_able = (event.y - @y > 0 and event.y - @y < $game_party.actors[0].range and @x == event.x)
- when 4
- attack_able = (@x - event.x > 0 and @x - event.x < $game_party.actors[0].range and @y == event.y)
- when 6
- attack_able = (event.x - @x > 0 and event.x - @x < $game_party.actors[0].range and @y == event.y)
- when 8
- attack_able = (@y - event.y > 0 and @y - event.y < $game_party.actors[0].range and @x == event.x)
- end
- if attack_able
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger? and event.enemy != nil and @action_wait_count <= 0 and event.enemy.id != 100
- make_attack(event)
- result = true
- @action_wait_count = 45 - $game_party.actors[0].dex / 5 + BASE_ACTION_COUNT
- end
- end
- end
- end
- return result
- end
- def make_attack(event)
- # 设置攻击 ID
- if $game_party.actors[0].animation1_id == 0
- self.white_flash = true
- else
- self.animation_id = $game_party.actors[0].animation1_id
- end
- event.damage = event.enemy.attack_effect($game_party.actors[0])
- event.critical = event.enemy.critical
- event.damage_pop = true
- event.animation_id = $game_party.actors[0].animation2_id
- return
- end
- end
复制代码 和这个有关的- #==============================================================================
- #ARPG系统 v1.0 按键设置
- #==============================================================================
- #KEY = [$R_Key_A,$R_Key_S,$R_Key_D,$R_Key_F,$R_Key_G]
- #招式\物品快捷键的设置,因为全键盘脚本本身的冲突放弃了= =
- KEY_NAME = ["A","S","D","F","G"] #招式\物品快捷键的名字
- KEY_NAME_2 = ["1", "2", "3", "4"]
- MAP_KEY = $R_Key_TAB #小地图是否显示的快捷键的设置
- MAP_SKILL_KEY = $R_Key_T #地图技能键
- MENU_SKILL_KEY = $R_Key_P #援助技能键
- MENU_KEY = [$R_Key_Z,$R_Key_X,$R_Key_C,$R_Key_V] #快速呼叫各场景菜单使用的按键,从左到右分别为menu, equip, status, skill
- BASE_TURN_COUNT = 100 #状态的基础持续祯数
- BASE_ACTION_COUNT = 10
- JUMP_KEY = $R_Key_E
- JUMP_SE = "Audio/se/015-jump01"
- SKILL_IN_DANGER = [180, 181, 182] #三个主角分别的危机技能
- SKILL_IN_MAP = [170, 171, 172] #三个主角分别的地图技能
- SKILL_IN_MENU = [175, 176,177] #三个主角分别的援助技能
- TARGET = 5 #储存敌人ID的变量
- #==============================================================================
- #ARPG系统 v1.0 系统说明
- #==============================================================================
- =begin
- 本游戏系统经过大幅度更改,提取并使用其中单个脚本极其有可能出错。
- 如果需要其中的插件脚本,请自行上66RPG站点搜索。
- 名字前边带!的地图是战斗地图。
- 为了方便设置,一个地图如果带!,它下边的地图就全部是战斗地图了。
- =end
复制代码 求前辈帮帮忙啊!谢谢! |
评分
-
查看全部评分
|