设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 929|回复: 3
打印 上一主题 下一主题

[已经解决] 脚本加载不了!!

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
2 小时
注册时间
2009-8-21
帖子
96
跳转到指定楼层
1
发表于 2009-8-27 21:30:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
#  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
# 内部使用。
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     troop_id     : 循环 ID
  #     member_index : 循环成员的索引
  #--------------------------------------------------------------------------
  def initialize(troop_id, member_index)
    super()
    @troop_id = troop_id
    @member_index = member_index
    troop = $data_troops[@troop_id]
    @enemy_id = troop.members[@member_index].enemy_id
    enemy = $data_enemies[@enemy_id]
    @battler_name = enemy.battler_name
    @battler_hue = enemy.battler_hue
    @hp = maxhp
    @sp = maxsp
    @hidden = troop.members[@member_index].hidden
    @immortal = troop.members[@member_index].immortal
  end
  #--------------------------------------------------------------------------
  # ● 获取敌人 ID
  #--------------------------------------------------------------------------
  def id
    return @enemy_id
  end
  #--------------------------------------------------------------------------
  # ● 获取索引
  #--------------------------------------------------------------------------
  def index
    return @member_index
  end
  #--------------------------------------------------------------------------
  # ● 获取名称
  #--------------------------------------------------------------------------
  def name
    return $data_enemies[@enemy_id].name
  end
  #--------------------------------------------------------------------------
  # ● 获取基本 MaxHP
  #--------------------------------------------------------------------------
  def base_maxhp
    return $data_enemies[@enemy_id].maxhp
  end
  #--------------------------------------------------------------------------
  # ● 获取基本 MaxSP
  #--------------------------------------------------------------------------
  def base_maxsp
    return $data_enemies[@enemy_id].maxsp
  end
  #--------------------------------------------------------------------------
  # ● 获取基本力量
  #--------------------------------------------------------------------------
  def base_str
    return $data_enemies[@enemy_id].str
  end
  #--------------------------------------------------------------------------
  # ● 获取基本灵巧
  #--------------------------------------------------------------------------
  def base_dex
    return $data_enemies[@enemy_id].dex
  end
  #--------------------------------------------------------------------------
  # ● 获取基本速度
  #--------------------------------------------------------------------------
  def base_agi
    return $data_enemies[@enemy_id].agi
  end
  #--------------------------------------------------------------------------
  # ● 获取基本魔力
  #--------------------------------------------------------------------------
  def base_int
    if @enemy_id == 50
      return 1600
      else
    return $data_enemies[@enemy_id].int
  end
  #--------------------------------------------------------------------------
  # ● 获取基本攻击力
  #--------------------------------------------------------------------------
  def base_atk
    if @enemy_id == 50
      return 1200
      else
    return $data_enemies[@enemy_id].atk
  end
  #--------------------------------------------------------------------------
  # ● 获取基本物理防御
  #--------------------------------------------------------------------------
  def base_pdef
    if @enemy_id == 50
      return 1600
      else
    return $data_enemies[@enemy_id].pdef
  end
  #--------------------------------------------------------------------------
  # ● 获取基本魔法防御
  #--------------------------------------------------------------------------
  def base_mdef
     if @enemy_id == 50
      return 2200
      else
    return $data_enemies[@enemy_id].mdef
  end
  #--------------------------------------------------------------------------
  # ● 获取基本回避修正
  #--------------------------------------------------------------------------
  def base_eva
    return $data_enemies[@enemy_id].eva
  end
  #--------------------------------------------------------------------------
  # ● 普通攻击 获取攻击方动画 ID
  #--------------------------------------------------------------------------
  def animation1_id
    return $data_enemies[@enemy_id].animation1_id
  end
  #--------------------------------------------------------------------------
  # ● 普通攻击 获取对像方动画 ID
  #--------------------------------------------------------------------------
  def animation2_id
    return $data_enemies[@enemy_id].animation2_id
  end
  #--------------------------------------------------------------------------
  # ● 获取属性修正值
  #     element_id : 属性 ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # 获取对应属性有效度的数值
    table = [0,200,150,100,50,0,-100]
    result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
    # 状态能防御本属性的情况下效果减半
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # 过程结束
    return result
  end
  #--------------------------------------------------------------------------
  # ● 获取属性有效度
  #--------------------------------------------------------------------------
  def state_ranks
    return $data_enemies[@enemy_id].state_ranks
  end
  #--------------------------------------------------------------------------
  # ● 属性防御判定
  #     state_id : 状态 ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    return false
  end
  #--------------------------------------------------------------------------
  # ● 获取普通攻击属性
  #--------------------------------------------------------------------------
  def element_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 获取普通攻击的状态变化 (+)
  #--------------------------------------------------------------------------
  def plus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 获取普通攻击的状态变化 (-)
  #--------------------------------------------------------------------------
  def minus_state_set
    return []
  end
  #--------------------------------------------------------------------------
  # ● 获取行动
  #--------------------------------------------------------------------------
  def actions
    return $data_enemies[@enemy_id].actions
  end
  #--------------------------------------------------------------------------
  # ● 获取 EXP
  #--------------------------------------------------------------------------
  def exp
    return $data_enemies[@enemy_id].exp
  end
  #--------------------------------------------------------------------------
  # ● 获取金钱
  #--------------------------------------------------------------------------
  def gold
    return $data_enemies[@enemy_id].gold
  end
  #--------------------------------------------------------------------------
  # ● 获取物品 ID
  #--------------------------------------------------------------------------
  def item_id
    return $data_enemies[@enemy_id].item_id
  end
  #--------------------------------------------------------------------------
  # ● 获取武器 ID
  #--------------------------------------------------------------------------
  def weapon_id
    return $data_enemies[@enemy_id].weapon_id
  end
  #--------------------------------------------------------------------------
  # ● 获取放具 ID
  #--------------------------------------------------------------------------
  def armor_id
    return $data_enemies[@enemy_id].armor_id
  end
  #--------------------------------------------------------------------------
  # ● 获取宝物出现率
  #--------------------------------------------------------------------------
  def treasure_prob
    return $data_enemies[@enemy_id].treasure_prob
  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面 X 坐标
  #--------------------------------------------------------------------------
  def screen_x
    return $data_troops[@troop_id].members[@member_index].x
  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面 Y 坐标
  #--------------------------------------------------------------------------
  def screen_y
    return $data_troops[@troop_id].members[@member_index].y
  end
  #--------------------------------------------------------------------------
  # ● 取得战斗画面 Z 坐标
  #--------------------------------------------------------------------------
  def screen_z
    return screen_y
  end
  #--------------------------------------------------------------------------
  # ● 逃跑
  #--------------------------------------------------------------------------
  def escape
    # 设置击中标志
    @hidden = true
    # 清除当前行动
    self.current_action.clear
  end
  #--------------------------------------------------------------------------
  # ● 变身
  #     enemy_id : 变身为的敌人 ID
  #--------------------------------------------------------------------------
  def transform(enemy_id)
    # 更改敌人 ID
    @enemy_id = enemy_id
    # 更改战斗图形
    @battler_name = $data_enemies[@enemy_id].battler_name
    @battler_hue = $data_enemies[@enemy_id].battler_hue
    # 在生成行动
    make_action
  end
  #--------------------------------------------------------------------------
  # ● 生成行动
  #--------------------------------------------------------------------------
  def make_action
    # 清除当前行动
    self.current_action.clear
    # 无法行动的情况
    unless self.movable?
      # 过程结束
      return
    end
    # 抽取现在有效的行动
    available_actions = []
    rating_max = 0
    for action in self.actions
      # 确认回合条件
      n = $game_temp.battle_turn
      a = action.condition_turn_a
      b = action.condition_turn_b
      if (b == 0 and n != a) or
         (b > 0 and (n < 1 or n < a or n % b != a % b))
        next
      end
      # 确认 HP 条件
      if self.hp * 100.0 / self.maxhp > action.condition_hp
        next
      end
      # 确认等级条件
      if $game_party.max_level < action.condition_level
        next
      end
      # 确认开关条件
      switch_id = action.condition_switch_id
      if switch_id > 0 and $game_switches[switch_id] == false
        next
      end
      # 符合条件 : 添加本行动
      available_actions.push(action)
      if action.rating > rating_max
        rating_max = action.rating
      end
    end
    # 最大概率值作为 3 合计计算(0 除外)
    ratings_total = 0
    for action in available_actions
      if action.rating > rating_max - 3
        ratings_total += action.rating - (rating_max - 3)
      end
    end
    # 概率合计不为 0 的情况下
    if ratings_total > 0
      # 生成随机数
      value = rand(ratings_total)
      # 设置对应生成随机数的当前行动
      for action in available_actions
        if action.rating > rating_max - 3
          if value < action.rating - (rating_max - 3)
            self.current_action.kind = action.kind
            self.current_action.basic = action.basic
            self.current_action.skill_id = action.skill_id
            self.current_action.decide_random_target_for_enemy
            return
          else
            value -= action.rating - (rating_max - 3)
          end
        end
      end
    end
  end
end

Lv1.梦旅人

梦石
0
星屑
75
在线时间
2 小时
注册时间
2009-8-21
帖子
96
2
 楼主| 发表于 2009-8-27 21:35:59 | 只看该作者
我就是按敌人能力值突破上限修改的脚本  可是测试脚本加载错误呢!!! 参照http://rpg.blue/web/index.php?doc-view-3186 此贴改的
回复 支持 反对

使用道具 举报

Lv3.寻梦者

小柯的徒弟

梦石
0
星屑
1535
在线时间
1157 小时
注册时间
2008-5-24
帖子
3085

贵宾

3
发表于 2009-8-28 07:55:45 | 只看该作者
  1. #==============================================================================
  2. # ■ Game_Enemy
  3. #------------------------------------------------------------------------------
  4. #  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
  5. # 内部使用。
  6. #==============================================================================

  7. class Game_Enemy < Game_Battler
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     troop_id     : 循环 ID
  11.   #     member_index : 循环成员的索引
  12.   #--------------------------------------------------------------------------
  13.   def initialize(troop_id, member_index)
  14.     super()
  15.     @troop_id = troop_id
  16.     @member_index = member_index
  17.     troop = $data_troops[@troop_id]
  18.     @enemy_id = troop.members[@member_index].enemy_id
  19.     enemy = $data_enemies[@enemy_id]
  20.     @battler_name = enemy.battler_name
  21.     @battler_hue = enemy.battler_hue
  22.     @hp = maxhp
  23.     @sp = maxsp
  24.     @hidden = troop.members[@member_index].hidden
  25.     @immortal = troop.members[@member_index].immortal
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 获取敌人 ID
  29.   #--------------------------------------------------------------------------
  30.   def id
  31.     return @enemy_id
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取索引
  35.   #--------------------------------------------------------------------------
  36.   def index
  37.     return @member_index
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 获取名称
  41.   #--------------------------------------------------------------------------
  42.   def name
  43.     return $data_enemies[@enemy_id].name
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取基本 MaxHP
  47.   #--------------------------------------------------------------------------
  48.   def base_maxhp
  49.     return $data_enemies[@enemy_id].maxhp
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 获取基本 MaxSP
  53.   #--------------------------------------------------------------------------
  54.   def base_maxsp
  55.     return $data_enemies[@enemy_id].maxsp
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 获取基本力量
  59.   #--------------------------------------------------------------------------
  60.   def base_str
  61.     return $data_enemies[@enemy_id].str
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 获取基本灵巧
  65.   #--------------------------------------------------------------------------
  66.   def base_dex
  67.     return $data_enemies[@enemy_id].dex
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 获取基本速度
  71.   #--------------------------------------------------------------------------
  72.   def base_agi
  73.     return $data_enemies[@enemy_id].agi
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 获取基本魔力
  77.   #--------------------------------------------------------------------------
  78.   def base_int
  79.     if @enemy_id == 50
  80.       return 1600
  81.       else
  82.     return $data_enemies[@enemy_id].int
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 获取基本攻击力
  87.   #--------------------------------------------------------------------------
  88.   def base_atk
  89.     if @enemy_id == 50
  90.       return 1200
  91.       else
  92.     return $data_enemies[@enemy_id].atk
  93.     end
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 获取基本物理防御
  97.   #--------------------------------------------------------------------------
  98.   def base_pdef
  99.     if @enemy_id == 50
  100.       return 1600
  101.       else
  102.     return $data_enemies[@enemy_id].pdef
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 获取基本魔法防御
  107.   #--------------------------------------------------------------------------
  108.   def base_mdef
  109.      if @enemy_id == 50
  110.       return 2200
  111.       else
  112.     return $data_enemies[@enemy_id].mdef
  113.     end
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 获取基本回避修正
  117.   #--------------------------------------------------------------------------
  118.   def base_eva
  119.     return $data_enemies[@enemy_id].eva
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 普通攻击 获取攻击方动画 ID
  123.   #--------------------------------------------------------------------------
  124.   def animation1_id
  125.     return $data_enemies[@enemy_id].animation1_id
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 普通攻击 获取对像方动画 ID
  129.   #--------------------------------------------------------------------------
  130.   def animation2_id
  131.     return $data_enemies[@enemy_id].animation2_id
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 获取属性修正值
  135.   #     element_id : 属性 ID
  136.   #--------------------------------------------------------------------------
  137.   def element_rate(element_id)
  138.     # 获取对应属性有效度的数值
  139.     table = [0,200,150,100,50,0,-100]
  140.     result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
  141.     # 状态能防御本属性的情况下效果减半
  142.     for i in @states
  143.       if $data_states[i].guard_element_set.include?(element_id)
  144.         result /= 2
  145.       end
  146.     end
  147.     # 过程结束
  148.     return result
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 获取属性有效度
  152.   #--------------------------------------------------------------------------
  153.   def state_ranks
  154.     return $data_enemies[@enemy_id].state_ranks
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 属性防御判定
  158.   #     state_id : 状态 ID
  159.   #--------------------------------------------------------------------------
  160.   def state_guard?(state_id)
  161.     return false
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 获取普通攻击属性
  165.   #--------------------------------------------------------------------------
  166.   def element_set
  167.     return []
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 获取普通攻击的状态变化 (+)
  171.   #--------------------------------------------------------------------------
  172.   def plus_state_set
  173.     return []
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 获取普通攻击的状态变化 (-)
  177.   #--------------------------------------------------------------------------
  178.   def minus_state_set
  179.     return []
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 获取行动
  183.   #--------------------------------------------------------------------------
  184.   def actions
  185.     return $data_enemies[@enemy_id].actions
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 获取 EXP
  189.   #--------------------------------------------------------------------------
  190.   def exp
  191.     return $data_enemies[@enemy_id].exp
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 获取金钱
  195.   #--------------------------------------------------------------------------
  196.   def gold
  197.     return $data_enemies[@enemy_id].gold
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 获取物品 ID
  201.   #--------------------------------------------------------------------------
  202.   def item_id
  203.     return $data_enemies[@enemy_id].item_id
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 获取武器 ID
  207.   #--------------------------------------------------------------------------
  208.   def weapon_id
  209.     return $data_enemies[@enemy_id].weapon_id
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 获取放具 ID
  213.   #--------------------------------------------------------------------------
  214.   def armor_id
  215.     return $data_enemies[@enemy_id].armor_id
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 获取宝物出现率
  219.   #--------------------------------------------------------------------------
  220.   def treasure_prob
  221.     return $data_enemies[@enemy_id].treasure_prob
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 取得战斗画面 X 坐标
  225.   #--------------------------------------------------------------------------
  226.   def screen_x
  227.     return $data_troops[@troop_id].members[@member_index].x
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 取得战斗画面 Y 坐标
  231.   #--------------------------------------------------------------------------
  232.   def screen_y
  233.     return $data_troops[@troop_id].members[@member_index].y
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 取得战斗画面 Z 坐标
  237.   #--------------------------------------------------------------------------
  238.   def screen_z
  239.     return screen_y
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 逃跑
  243.   #--------------------------------------------------------------------------
  244.   def escape
  245.     # 设置击中标志
  246.     @hidden = true
  247.     # 清除当前行动
  248.     self.current_action.clear
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 变身
  252.   #     enemy_id : 变身为的敌人 ID
  253.   #--------------------------------------------------------------------------
  254.   def transform(enemy_id)
  255.     # 更改敌人 ID
  256.     @enemy_id = enemy_id
  257.     # 更改战斗图形
  258.     @battler_name = $data_enemies[@enemy_id].battler_name
  259.     @battler_hue = $data_enemies[@enemy_id].battler_hue
  260.     # 在生成行动
  261.     make_action
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 生成行动
  265.   #--------------------------------------------------------------------------
  266.   def make_action
  267.     # 清除当前行动
  268.     self.current_action.clear
  269.     # 无法行动的情况
  270.     unless self.movable?
  271.       # 过程结束
  272.       return
  273.     end
  274.     # 抽取现在有效的行动
  275.     available_actions = []
  276.     rating_max = 0
  277.     for action in self.actions
  278.       # 确认回合条件
  279.       n = $game_temp.battle_turn
  280.       a = action.condition_turn_a
  281.       b = action.condition_turn_b
  282.       if (b == 0 and n != a) or
  283.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  284.         next
  285.       end
  286.       # 确认 HP 条件
  287.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  288.         next
  289.       end
  290.       # 确认等级条件
  291.       if $game_party.max_level < action.condition_level
  292.         next
  293.       end
  294.       # 确认开关条件
  295.       switch_id = action.condition_switch_id
  296.       if switch_id > 0 and $game_switches[switch_id] == false
  297.         next
  298.       end
  299.       # 符合条件 : 添加本行动
  300.       available_actions.push(action)
  301.       if action.rating > rating_max
  302.         rating_max = action.rating
  303.       end
  304.     end
  305.     # 最大概率值作为 3 合计计算(0 除外)
  306.     ratings_total = 0
  307.     for action in available_actions
  308.       if action.rating > rating_max - 3
  309.         ratings_total += action.rating - (rating_max - 3)
  310.       end
  311.     end
  312.     # 概率合计不为 0 的情况下
  313.     if ratings_total > 0
  314.       # 生成随机数
  315.       value = rand(ratings_total)
  316.       # 设置对应生成随机数的当前行动
  317.       for action in available_actions
  318.         if action.rating > rating_max - 3
  319.           if value < action.rating - (rating_max - 3)
  320.             self.current_action.kind = action.kind
  321.             self.current_action.basic = action.basic
  322.             self.current_action.skill_id = action.skill_id
  323.             self.current_action.decide_random_target_for_enemy
  324.             return
  325.           else
  326.             value -= action.rating - (rating_max - 3)
  327.           end
  328.         end
  329.       end
  330.     end
  331.   end
  332. end
复制代码
有很多忘了加上end……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
75
在线时间
2 小时
注册时间
2009-8-21
帖子
96
4
 楼主| 发表于 2009-8-28 09:26:42 | 只看该作者
恩啊  谢谢了!!!!!!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-1-10 17:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表