| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 4832 | 
 
| 最后登录 | 2017-3-16 | 
 
| 在线时间 | 50 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 50 小时
 
        - 注册时间
 - 2009-8-16
 
        - 帖子
 - 18
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 kekaishi 于 2009-11-13 09:11 编辑  
 
使用武器决定技能脚本後 
进入战斗便出现"脚本  武器决定技能的110行发生了NoMethoError" 
要怎麽解决? 
#============================================================================== 
# 武器决定技能 by 沉影不器 
#------------------------------------------------------------------------------ 
# 开放式RPG用 
# 每种武器都有特定的技能,必须装备该种武器才能使用 
# 角色的职业是开放性的,能够使用多种类型的武器,比如可以拿剑也可以拿枪或者弓 
# 同样的,角色能学习多种技能,比如剑技 枪技等 
# 当然也包括不受武器限制的技能,比如 盗帅冬瓜 的 犯贱 技能这类 
#------------------------------------------------------------------------------ 
# 使用方法: 
# ① 数据库中设定属性,让相关联的武器和技能同时选用该属性 
#    例: 数据库中设定"剑"属性,所有剑类的武器都选此属性;所有剑类的技能都选此属性 
#        比如:[武器]玄铁重剑 钩选"剑"属性,[技能]独孤九剑 钩选"剑"属性 
#        未钩选任何武器和技能关联的属性,即是不受武器限制的技能 
# ② 复制脚本,插入到main之前 
# ③ 脚本第23行 设定武器和技能关联的属性id 
#    比如范例中,从第17号属性开始到24号属性都是武器关联技能的属性,依次填入 
# ④ 数据库中设定名为"全体化"的属性,凡带此属性的武器,其普通攻击变为攻击敌全体 
#============================================================================== 
 
class Game_Battler 
#-------------------------------------------------------------------------- 
SW_SET = [16,17,18,19,20,21,22,23,24] # 此处设定武器和技能关联的属性id 
#-------------------------------------------------------------------------- 
def skill_can_use?(skill_id) 
   if self.is_a?(Game_Actor) and self.weapon_id > 0 
     sw_boolean = false # 判断武器和技能关联 
     s = SW_SET & $data_skills[skill_id].element_set 
     if s.empty? 
       sw_boolean = true 
     else 
       for i in s 
         if  $data_weapons[self.weapon_id].element_set .include?(i) 
           sw_boolean = true 
           break 
         end 
       end 
     end 
     if sw_boolean == false 
       return false 
     end 
   end 
   if $data_skills[skill_id].sp_cost > self.sp 
     return false 
   end 
   if dead? 
     return false 
   end 
   if $data_skills[skill_id].atk_f == 0 and self.restriction == 1 
     return false 
   end 
   occasion = $data_skills[skill_id].occasion 
   if $game_temp.in_battle 
     return (occasion == 0 or occasion == 1) 
   else 
     return (occasion == 0 or occasion == 2) 
   end 
end 
end 
#============================================================================== 
 
class Window_Skill < Window_Selectable 
#-------------------------------------------------------------------------- 
def refresh 
   if self.contents != nil 
     self.contents.dispose 
     self.contents = nil 
   end 
   @data = [] 
   for i in [email protected] 
     skill = $data_skills[@actor.skills] 
     if skill != nil and @actor.skill_can_use?(skill.id) # 排除无法使用的技能 
       @data.push(skill) 
     end 
   end 
   @item_max = @data.size 
   if @item_max > 0 
     self.contents = Bitmap.new(width - 32, row_max * 32) 
     for i in 0...@item_max 
       draw_item(i) 
     end 
   end 
end 
end 
#============================================================================== 
 
class Scene_Battle 
#-------------------------------------------------------------------------- 
def scope_id 
   scope = 0 
   for i in 1...$data_system.elements.size 
     if $data_system.elements =~ /全体化/ 
       scope = i 
       break 
     end 
   end 
   return scope 
end 
#-------------------------------------------------------------------------- 
def update_phase3_basic_command 
   if Input.trigger?(Input::B) 
     $game_system.se_play($data_system.cancel_se) 
     phase3_prior_actor 
     return 
   end 
   if Input.trigger?(Input::C) 
     case @actor_command_window.index 
     when 0  # 攻击 
       $game_system.se_play($data_system.decision_se) 
       @active_battler.current_action.kind = 0 
       @active_battler.current_action.basic = 0 
       # 开始选择敌人 
       if @active_battler.weapon_id > 0 and 
         $data_weapons[@active_battler.weapon_id].element_set.include?(scope_id) 
         phase3_next_actor 
       else 
         start_enemy_select 
       end 
     when 1  # 特技 
       $game_system.se_play($data_system.decision_se) 
       @active_battler.current_action.kind = 1 
       start_skill_select 
     when 2  # 防御 
       $game_system.se_play($data_system.decision_se) 
       @active_battler.current_action.kind = 0 
       @active_battler.current_action.basic = 1 
       phase3_next_actor 
     when 3  # 物品 
       $game_system.se_play($data_system.decision_se) 
       @active_battler.current_action.kind = 2 
       start_item_select 
     when 4  # 变更武器 
       # 演奏确定 SE 
       $game_system.se_play($data_system.decision_se) 
       # 设置行动 
       @active_battler.current_action.kind = 3 
        # 开始选择武器 
       start_weapon_select 
     end 
     return 
   end 
end 
#-------------------------------------------------------------------------- 
def make_basic_action_result # 改写自 随机全体化的武器装备(柳柳) 
   if @active_battler.current_action.basic == 0 
     @animation1_id = @active_battler.animation1_id 
     @animation2_id = @active_battler.animation2_id 
     if @active_battler.is_a?(Game_Enemy) 
       if @active_battler.restriction == 3 
         target = $game_troop.random_target_enemy 
       elsif @active_battler.restriction == 2 
         target = $game_party.random_target_actor 
       else 
         index = @active_battler.current_action.target_index 
         target = $game_party.smooth_target_actor(index) 
       end 
     end 
     if @active_battler.is_a?(Game_Actor) 
       if @active_battler.restriction == 3 
         target = $game_party.random_target_actor 
       elsif @active_battler.restriction == 2 
         target = $game_troop.random_target_enemy 
       else 
         # 武器带[全体化]属性时 
         if @active_battler.weapon_id > 0 and 
           $data_weapons[@active_battler.weapon_id].element_set.include?(scope_id) 
           for enemy in $game_troop.enemies 
             if enemy.exist? 
               @target_battlers.push(enemy) 
             end 
           end 
         end 
         index = @active_battler.current_action.target_index 
         target = $game_troop.smooth_target_enemy(index) 
       end 
     end 
     if @target_battlers == [] 
       # 设置对像方的战斗者序列 
       @target_battlers = [target] 
     end 
     for target in @target_battlers 
       target.attack_effect(@active_battler) 
     end 
     return 
   end 
   if @active_battler.current_action.basic == 1 
     @help_window.set_text($data_system.words.guard, 1) 
     return 
   end 
   if @active_battler.is_a?(Game_Enemy) and 
      @active_battler.current_action.basic == 2 
     @help_window.set_text("逃跑", 1) 
     @active_battler.escape 
     return 
   end 
   if @active_battler.current_action.basic == 3 
     $game_temp.forcing_battler = nil 
     @phase4_step = 1 
     return 
   end 
end 
end |   
 
 
 
 |