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

Project1

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

[已经过期] 请教,关于吸收伤害回复的脚本,这哪里出问题了啊

[复制链接]

Lv2.观梦者

梦石
0
星屑
582
在线时间
310 小时
注册时间
2016-2-29
帖子
210
跳转到指定楼层
1
发表于 2016-3-3 17:17:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
C:\Documents and Settings\Administrator\桌面
下面放脚本

Lv2.观梦者

梦石
0
星屑
582
在线时间
310 小时
注册时间
2016-2-29
帖子
210
2
 楼主| 发表于 2016-3-3 17:19:06 | 只看该作者
艹,怎么上图啊
问题出在205行开始
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
582
在线时间
310 小时
注册时间
2016-2-29
帖子
210
3
 楼主| 发表于 2016-3-3 17:19:31 | 只看该作者
#==============================================================================
#
# ▼ Yanfly Engine Ace - Element Absorb v1.01
# -- Last Updated: 2012.01.23
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-Element Absorb"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.23 - Compatibility Update: Doppelganger
# 2011.12.14 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Absorbing elements have been taken out of RPG Maker VX Ace despite being a
# possible feature in the past RPG Maker iterations. This script brings back
# the ability to absorb elemental rates by applying them as traits for actors,
# classes, weapons, armours, enemies, and states.
#
# If a target is inherently strong against the element absorbed, then more
# will be absorbed. If the target is inherently weak to the element absorbed,
# then less will be absorbed. The rate of which absorption takes effect is
# dependent on the target's natural affinity to the element.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
# -----------------------------------------------------------------------------
# Weapons Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the states notebox in the database.
# -----------------------------------------------------------------------------
# <element absorb: x>
# <element absorb: x, x>
# Grants a trait to absorb element x and heal the battler.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module ELEMENT_ABSORB
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Absorption Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Here, you can change how the game handles absorption when there are
    # multiple elements being calculated. If the following setting is set to
    # true, then the absorption takes priority. If false, then absorption is
    # ignored and the damage is calculated normally.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    MULTI_ELEMENT_ABSORB_PRIORITY = true
   
  end # ELEMENT_ABSORB
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
  module REGEXP
  module BASEITEM
   
    ELE_ABSORB = /<(?:ELEMENT_ABSORB|element absorb):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
   
  end # BASEITEM
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_eabs load_database; end
  def self.load_database
    load_database_eabs
    load_notetags_eabs
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_eabs
  #--------------------------------------------------------------------------
  def self.load_notetags_eabs
    groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
      $data_enemies, $data_states]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_eabs
      end
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :element_absorb
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_eabs
  #--------------------------------------------------------------------------
  def load_notetags_eabs
    @element_absorb = []
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::BASEITEM::ELE_ABSORB
        $1.scan(/\d+/).each { |num|
        @element_absorb.push(num.to_i) if num.to_i > 0 }
      #---
      end
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: element_rate
  #--------------------------------------------------------------------------
  alias game_battler_element_rate_eabs element_rate
  def element_rate(element_id)
    result = game_battler_element_rate_eabs(element_id)
    if element_absorb?(element_id)
      result = [result - 2.0, -0.01].min
    end
    return result
  end
  
  #--------------------------------------------------------------------------
  # new method: element_absorb?
  #--------------------------------------------------------------------------
  def element_absorb?(element_id)
    if actor?
      return true if self.actor.element_absorb.include?(element_id)
      return true if self.class.element_absorb.include?(element_id)
      for equip in equips
        next if equip.nil?
        return true if equip.element_absorb.include?(element_id)
      end
    else
      return true if self.enemy.element_absorb.include?(element_id)
      if $imported["YEA-Doppelganger"] && !self.class.nil?
       return true if self.class.element_absorb.include?(element_id)
      end
    end
    for state in states
      next if state.nil?
      return true if state.element_absorb.include?(element_id)
    end
    return false
  end
  
end # Game_BattlerBase

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: elements_max_rate
  #--------------------------------------------------------------------------
  alias game_battler_elements_max_rate_eabs elements_max_rate
  def elements_max_rate(elements)
    result = game_battler_elements_max_rate_eabs(elements)
    if YEA::ELEMENT_ABSORB::MULTI_ELEMENT_ABSORB_PRIORITY
      for element_id in elements
        next unless element_absorb?(element_id)
        result = [result - 2.0, -0.01].min
        return result
      end
    end
    return result
  end
  
end # Game_Battler

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
582
在线时间
310 小时
注册时间
2016-2-29
帖子
210
4
 楼主| 发表于 2016-3-3 17:20:39 | 只看该作者
艹了,居然没行数,
报错的地方在这
# new method: element_absorb?
  #--------------------------------------------------------------------------
  def element_absorb?(element_id)
    if actor?
      return true if self.actor.element_absorb.include?(element_id)
      return true if self.class.element_absorb.include?(element_id)
      for equip in equips
        next if equip.nil?
        return true if equip.element_absorb.include?(element_id)
      end
    else
      return true if self.enemy.element_absorb.include?(element_id)
      if $imported["YEA-Doppelganger"] && !self.class.nil?
       return true if self.class.element_absorb.include?(element_id)
      end
    end
    for state in states
      next if state.nil?
      return true if state.element_absorb.include?(element_id)
    end
    return false
  end
  
end # Game_BattlerBase

点评

稍安勿躁……先别急着爆粗。  发表于 2016-3-4 10:07
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
47
在线时间
155 小时
注册时间
2016-2-12
帖子
160
5
发表于 2016-3-4 17:38:00 | 只看该作者
不能连贴的
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1293
在线时间
995 小时
注册时间
2014-12-14
帖子
3016

开拓者

6
发表于 2016-3-7 13:51:44 | 只看该作者
  先说个题外话,论坛的帖子是可以二次编辑的,所以没太有连贴的必要。脚本直接贴上倒是有个好处:不会因为复制出现bug;但是一般的人还是喜欢用脚本框框住的,这样方便复制。

不清楚报错的原因。
不过可以这样试试:
1.翻译报错的字句,踹i莫它的含义
2.使用一个新建工程,测试该脚本是否仍报错。←使用控制变量法 将报错原因再缩小一下范围


【RMVA教程】
---------------------
欲买桂花同载酒,终不似,少年游.
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 04:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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