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

Project1

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

[已经过期] 有办法让这个脚本支援中文么?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
189 小时
注册时间
2013-1-26
帖子
72
跳转到指定楼层
1
发表于 2015-5-31 10:27:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
http://himeworks.com/redirect.ph ... k_Element_Modifiers


附上脚本

这是属性修正的脚本
在备注栏输入<attack element: fire 0.7>是可以执行的


<attack element: 火 0.7>
但一改成中文就失效了 就像这个样子

有办法修正这个么?

Lv1.梦旅人

梦石
0
星屑
60
在线时间
17 小时
注册时间
2008-3-3
帖子
57
2
发表于 2015-5-31 19:42:03 手机端发表。 | 只看该作者
去看看数据库里,fire调用对应的名称,然后再试着改数据库和语句里的名称
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
46 小时
注册时间
2014-3-14
帖子
37
3
发表于 2015-5-31 21:38:38 | 只看该作者
你就不能仔细读一下说明吗...
你的RMVA是Steam或者其他地方找来的英文版吧?
去检查一下你的数据库-用语-属性里到底有没有叫“火”的属性
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
189 小时
注册时间
2013-1-26
帖子
72
4
 楼主| 发表于 2015-6-1 19:38:57 | 只看该作者
有 数据库当然调过了

改成英文名就有作用 中文名就会失效
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10074
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

5
发表于 2015-6-1 20:18:40 | 只看该作者
本帖最后由 VIPArcher 于 2015-6-1 21:58 编辑

注:我并不知道这个脚本的规约,所以不知道是否允许转载,如果是禁止转载的话请通知我,我会删除这个回复
因为这个脚本的正则的问题,这是个英文脚本,所以它的正则并没有考虑非英文字符的情况,我这里帮你改一下你再试试吧。
  1. =begin
  2. #===============================================================================
  3. Title: Attack Element Modifiers
  4. Author: Hime
  5. Date: Oct 9, 2014
  6. URL: http://himeworks.com/2014/01/03/attack-element-modifiers/
  7. --------------------------------------------------------------------------------
  8. ** Change log
  9. Oct 9, 2014
  10.    - normal element works the default way if no tags are specified
  11. Mar 2, 2014
  12.    - added atk element rates to all feature objects as well
  13. Jan 3, 2014
  14.    - Initial release
  15. --------------------------------------------------------------------------------   
  16. ** Terms of Use
  17. * Free to use in non-commercial projects
  18. * Contact me for commercial use
  19. * No real support. The script is provided as-is
  20. * Will do bug fixes, but no compatibility patches
  21. * Features may be requested but no guarantees, especially if it is non-trivial
  22. * Credits to Hime Works in your project
  23. * Preserve this header
  24. --------------------------------------------------------------------------------
  25. ** Description

  26. This script allows you to set up "attack element modifiers". Basically, you can

  27. 1. Set up skills with multiple attack elements
  28. 2. Specify the attack element rate for each element

  29. By default, damage calculations are done by first calculating the skill's
  30. "base" damage, then applying the elemental modifiers. An elemental modifier
  31. is the difference between "elemental damage rate" and "elemental resist rate".
  32. For example, if your fire damage rate is 100% and the target's fire resist
  33. rate is 25%, then the actual fire damage is 75%. If your damage was 100% fire,
  34. then that means the actual damage you inflict is reduced by the target's
  35. resistance.

  36. Suppose you have a skill that inflicts both fire and earth
  37. elemental damage, and you want to make it so that the damage is 70% fire and
  38. 30% earth. With this script, it properly calculates the total damage dealt,
  39. after all elemental resistances have been applied.

  40. If an enemy has no fire resistance and has 50% earth resistance, then your
  41. final element multiplier is equal to 70% from fire + 15% from earth, for a
  42. total of 85% of the skill's base damage.

  43. --------------------------------------------------------------------------------
  44. ** Installation

  45. In the script editor, place this script below Materials and above Main

  46. --------------------------------------------------------------------------------
  47. ** Usage

  48. To specify an attack element, note-tag objects with

  49.    <attack element: ELEMENT_NAME>
  50.    
  51. Where the ELEMENT_NAME is the name of your element in the database. Refer to
  52. the Terms tab.

  53. You can note-tag actors, classes, weapons, armors, items, skills, states, or
  54. enemies.

  55. To specify attack element rates for each element, add the rate to the note-tag
  56. as a percentage

  57.    <attack element: ELEMENT_NAME RATE>

  58. Some example rates are
  59.    0.5 means it deals 50%
  60.    1.0 means it deals 100%
  61.    2.0 means it deals 200%
  62.    
  63. -- Damage Element Type --

  64. Elemental damage is calculated in two different ways depending on the skill's
  65. element type.

  66. If the element type is "normal", then it takes the user's attack elements and
  67. calculates damage based on those.

  68. If there are multiple objects contributing to atk elements, then it will
  69. average out each element individually. For example, if you were dual-wielding
  70. a sword that does 30% fire damage and 70% physical damage, and you had another
  71. sword that does 50% fire and 50% physical damage, then the total damage that
  72. you will do is 40% fire and 60% physical. You can verify that the math is
  73. correct.

  74. If the element type is anything else, then it takes the skill's attack
  75. elements.

  76. When you note-tag a skill with atk elements, then that is assumed to be the
  77. skill's damage element types.
  78.    
  79. --------------------------------------------------------------------------------
  80. ** Example

  81. To specify that your skill inflicts 70% fire and 30% earth damage, you would
  82. note-tag it with

  83.    <attack element: fire 0.7>
  84.    <attack element: earth 0.3>

  85. #===============================================================================
  86. =end
  87. $imported = {} if $imported.nil?
  88. $imported[:TH_AttackElementModifiers] = true
  89. #===============================================================================
  90. # ** Configuration
  91. #===============================================================================
  92. module TH
  93.   module Attack_Element_Modifiers
  94.     Regex = /<attack[-_ ]element:\s*(.*)[ ](.*?)\s*>/i
  95.   end
  96. end
  97. #===============================================================================
  98. # ** Rest of Script
  99. #===============================================================================
  100. module RPG
  101.   
  102.   class BaseItem
  103.    
  104.     def atk_element_modifiers
  105.       load_notetag_atk_element_modifiers unless @atk_element_modifiers
  106.       return @atk_element_modifiers
  107.     end
  108.    
  109.     def load_notetag_atk_element_modifiers
  110.       @atk_element_modifiers = {}
  111.       
  112.       # Get all of the element modifiers
  113.       elements = $data_system.elements.map {|name| name.downcase}
  114.       results = self.note.scan(TH::Attack_Element_Modifiers::Regex)
  115.       results.each do |res|
  116.         element_id = elements.index(res[0].downcase)
  117.         value = res[1].empty? ? 1.0 : res[1].to_f
  118.         @atk_element_modifiers[element_id] = value
  119.       end
  120.     end
  121.   end
  122.   
  123.   class UsableItem < BaseItem
  124.     def load_notetag_atk_element_modifiers
  125.       super      
  126.       self.damage.element_id = 0 unless @atk_element_modifiers.empty?
  127.     end
  128.    
  129.     alias :th_attack_atk_element_modifiers_damage :damage
  130.     def damage
  131.       load_notetag_atk_element_modifiers unless @atk_element_modifiers
  132.       th_attack_atk_element_modifiers_damage
  133.     end
  134.   end
  135. end

  136. class Game_Battler < Game_BattlerBase
  137.   
  138.   alias :th_attack_atk_element_modifiers_item_element_rate :item_element_rate
  139.   def item_element_rate(user, item)
  140.     if item.damage.element_id < 0
  141.       normal_atk_element_modifiers(user, item)
  142.     else
  143.       # Check if it uses multiple elements
  144.       if item.atk_element_modifiers.empty?
  145.         return th_attack_atk_element_modifiers_item_element_rate(user, item)
  146.       else
  147.         return item_multi_element_rate(user, item)
  148.       end
  149.     end
  150.   end
  151.   
  152.   #-----------------------------------------------------------------------------
  153.   # Takes atk element rates from all feature objects. If multiple objects
  154.   # define atk elements, then it divides the rates proportionally. If there
  155.   # are no atk elements, then we assume it s a "null" element type which means
  156.   # there is no elemental modifiers.
  157.   #-----------------------------------------------------------------------------
  158.   def normal_atk_element_modifiers(user, item)
  159.     count = 0
  160.     rates = {}
  161.     user.feature_objects.each do |obj|
  162.       next if obj.atk_element_modifiers.empty?
  163.       count += 1
  164.       obj.atk_element_modifiers.each do |id, val|
  165.         rates[id] ||= 0
  166.         rates[id] += val
  167.       end
  168.     end
  169.    
  170.     return th_attack_atk_element_modifiers_item_element_rate(user, item) if rates.empty?
  171.     return rates.inject(0) do |r, (id, val)|
  172.       r + element_rate(id) / count * val
  173.     end
  174.   end

  175.   #-----------------------------------------------------------------------------
  176.   #
  177.   #-----------------------------------------------------------------------------
  178.   def item_multi_element_rate(user, item)
  179.     return item.atk_element_modifiers.inject(0) do |r, (id, val)|
  180.       r + element_rate(id) * val
  181.     end
  182.   end
  183. end
复制代码
未测试

点评

还是不行 , 同样换成英文就可以 , 中文就失败了  发表于 2015-6-1 22:44
换了个正则的写法,你再复制一遍试试,备注要这样<attack element: 黑暗 0.7>属性和数字之间一定要有一个空格。  发表于 2015-6-1 21:59
谢谢帮忙更改,但中文还是没有效果  发表于 2015-6-1 20:47
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-7 07:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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