查看: 3927|回复: 9

[已经过期] 通过修改脚本能不能增加人物属性数量?

[复制链接]
梦石
0
星屑
360
在线时间
7 小时
注册时间
2011-5-29
回帖
2
发表于 2013-3-31 19:16:12 | 显示全部楼层 |阅读模式

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

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

×
RT,通过修改脚本能不能增加人物属性数量?
比如智力,力量一类的
梦石
0
星屑
50
在线时间
42 小时
注册时间
2013-2-3
回帖
17
发表于 2013-4-1 01:20:02 | 显示全部楼层
可以弄个加点脚本  我截一段

STR_POINT        = ["体质","精神","力量","智力","耐力","敏捷","???"]
  #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  POINT_ADD_PARAM = [[15 ,  0,   0,  1,   0,   1,   0,   0],     #体质
                     [0  ,  1,   0,  0,   0,   2,   0,   2],     #精神
                     [0  ,  0,   1,  0,   0,   0,   0,   0],     #力量
                     [0  ,0.5,   0,  0,   1, 0.5,   0,   1],     #智力
                     [5  ,  0,   0,  2,   0, 0.5,   0,   0],     #耐力
                     [0  ,  0, 0.5,  0,   0,   0, 0.1,   0]]     #敏捷
回复

使用道具 举报

梦石
0
星屑
50
在线时间
77 小时
注册时间
2006-6-12
回帖
85
发表于 2013-4-1 20:16:12 | 显示全部楼层
本帖最后由 wangxinly 于 2013-4-1 20:26 编辑

角色的属性值是由职业带来的基础值和角色本身的附加值以及装备提供的附加值这3部分组合的。只有本身的附加值是可以改的,其他都是固定的。
你要新增属性值就要自己定义一个了

官方默认有8个变量,要增加就得要自己定义相关的变量号的3部分的定义,或者自己新增一个实例变量
回复

使用道具 举报

梦石
0
星屑
360
在线时间
7 小时
注册时间
2011-5-29
回帖
2
 楼主| 发表于 2013-4-2 00:05:45 | 显示全部楼层
zhang58604616 发表于 2013-4-1 01:20
可以弄个加点脚本  我截一段

STR_POINT        = ["体质","精神","力量","智力","耐力","敏捷","???"]

我准备直接改
class RPG::Class
不过里面的
    @features.push(RPG::BaseItem::Feature.new(23, 0, 1))
    @features.push(RPG::BaseItem::Feature.new(22, 0, 0.95))
    @features.push(RPG::BaseItem::Feature.new(22, 1, 0.05))
    @features.push(RPG::BaseItem::Feature.new(22, 2, 0.04))
    @features.push(RPG::BaseItem::Feature.new(41, 1))
    @features.push(RPG::BaseItem::Feature.new(51, 1))
    @features.push(RPG::BaseItem::Feature.new(52, 1))
这段是什么意思?给职业附加特性么
几个参数都没看明白是什么意思

回复

使用道具 举报

梦石
0
星屑
360
在线时间
7 小时
注册时间
2011-5-29
回帖
2
 楼主| 发表于 2013-4-2 00:13:00 | 显示全部楼层
wangxinly 发表于 2013-4-1 20:16
角色的属性值是由职业带来的基础值和角色本身的附加值以及装备提供的附加值这3部分组合的。只有本身的附加 ...

如果我在
RPG::Class 里面追加了(8..11).each {|j| @params[j,i] = 30+i*5/2 }
然后在
Game_BattlerBase里面追加
def str;  param(8);   end    # 力量
那么我在数据库的技能设置里面,计算公式里面是不是就直接可以用a.str这个变量了?
回复

使用道具 举报

梦石
0
星屑
50
在线时间
77 小时
注册时间
2006-6-12
回帖
85
发表于 2013-4-2 18:00:30 | 显示全部楼层
jiangpengo 发表于 2013-4-2 00:13
如果我在
RPG::Class 里面追加了(8..11).each {|j| @params[j,i] = 30+i*5/2 }
然后在

不行的,角色的param是由职业的基础部分和自身的附加值和装备附加值3部分组成,RPG::Class 是职业的基础值。
你这样没有定义后边2部分会报错的

建议直接定义一个变量来使用更加方便,不过我现在在上班,不能给例子你,我要晚上10点半到家之后才能给个例子你看的
回复

使用道具 举报

梦石
0
星屑
50
在线时间
77 小时
注册时间
2006-6-12
回帖
85
发表于 2013-4-2 18:29:06 | 显示全部楼层
jiangpengo 发表于 2013-4-2 00:05
我准备直接改
class RPG::Class
不过里面的

是的没错,这个是职业的特性,就是能使用什么类型的特技,武器,装备,被攻击几率,命中率,必杀率等等
不过这个没有等级判定的,另外这个是在数据库里设置,用脚本改的时候是无法直接保存修改的,因为每次新开游戏都会重新从本地文件读取数据库
回复

使用道具 举报

梦石
0
星屑
50
在线时间
77 小时
注册时间
2006-6-12
回帖
85
发表于 2013-4-3 16:50:41 | 显示全部楼层
jiangpengo 发表于 2013-4-2 00:13
如果我在
RPG::Class 里面追加了(8..11).each {|j| @params[j,i] = 30+i*5/2 }
然后在

在Game_BattlerBase里边添加
  attr_accessor :力量
并且在initialize里边用@力量=0来初始化
然后自己定义函数来提升数值,这样就能在数据库里边用"a.力量"来调用这个属性值了

不过这样是直接调用,如果要做到升级自动增加的话需要更复杂的脚本来做了
回复

使用道具 举报

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
回帖
103
发表于 2013-4-6 16:57:55 | 显示全部楼层
在外站找到一个脚本应该可以帮到你。先说一下用法:

在角色的备注里按照以下格式填写对应属性的成长公式:

  1. <xstat>
  2. :str => '(level/3.5) + 16',
  3. :con => '(level/5.6) + 12',
  4. :dex => '(level/5.25) + 15 + agi',
  5. :int => '(level/10.5) + 10',
  6. :wis => '(level/10.5) + 10',
  7. :cha => '(level/10.5) + 10',
  8. <xstat_end>
复制代码


也可以直接在角色或敌人的备注栏里填写固定数值:

  1. <xstat>
  2. :str => 15,
  3. :con => 14,
  4. :dex => 13,
  5. :int => 12,
  6. :wis => 11,
  7. :cha => 0,
  8. <xstat_end>
复制代码


在武器或护甲的备注里按照如下格式填写可以让该装备增加对应属性:

  1. <weapon_xstat: STAT x>
复制代码


范例,让装备增加5点‘str’属性:

  1. <weapon_xstat: str 5>
复制代码


调用属性:

  1. $game_actors[1].xstat.str
复制代码


范例,设置x技能的伤害公式为【人物的‘str’乘以5】:

  1. a.xstat.str * 5
复制代码


----------------------------------------------------------分割线------------------------------------------------------------

脚本:
  1. #===============================================================================
  2. #                                                N.A.S.T.Y. Extra Stats
  3. #                                  Nelderson's Awesome Scripts To You
  4. # By: Nelderson
  5. # Made On: 12/19/2011
  6. # Last Updated : 3/27/2012
  7. #===============================================================================
  8. # Update History:
  9. # - Version 1.1  - Cleaned up some shit, and added enemies xstats for Enemies!
  10. # - Version 1.0  - Initial release, made for the shit of it <img src='http://forums.rpgmakerweb.com/public/style_emoticons/<#EMO_DIR#>/tongue.png' class='bbc_emoticon' alt=':P' />
  11. #===============================================================================
  12. # *Notes:
  13. # - This script can be used to make all sorts of stats that can derive from
  14. #   an actor's level, and base stats.
  15. #
  16. # - This thing can be a pain to set up, but once it's done, it can be a very
  17. #   powerful way to include new stats into your game!
  18. #
  19. # - Made a quick edit to the status screen to show up to 6 stats!
  20. #
  21. # *Usage
  22. #
  23. # -First is the STATS section.  This is an array that holds all the new
  24. #  stats that everything else gets info from.
  25. #
  26. # - Next fill out the Default Level formula(Use Example Below as a guide)
  27. #   *ANYTHING that an actor has, you can base it off of (Except other XSTATS!)
  28. #           (level, hp, mp, atk, spi, agi, maxhp, etc.)
  29. #
  30. # -You can use the ACTOR and ENEMY NOTETAGS to customize
  31. #  the formulas for each actor.
  32. #
  33. #  Examples:
  34. #   Place the following in an actor's notebox(You must make one for each stat):
  35. #                 <xstat>
  36. #                 :str => '(level/3.5) + 16',
  37. #                 :con => '(level/5.6) + 12',
  38. #                 :dex => '(level/5.25) + 15 + agi',
  39. #                 :int => '(level/10.5) + 10',
  40. #                 :wis => '(level/10.5) + 10',
  41. #                 :cha => '(level/10.5) + 10',
  42. #                 <xstat_end>
  43. #
  44. #   Or you can place this in an actor's/enemy's notebox
  45. #                 <xstat>
  46. #                 :str => 15,
  47. #                 :con => 14,
  48. #                 :dex => 13,
  49. #                 :int => 12,
  50. #                 :wis => 11,
  51. #                 :cha => 0,
  52. #                 <xstat_end>
  53. #
  54. # - This script also uses notetags for weapons and armors to increase xstats
  55. #   if you want.  Just place in a notebox:
  56. #
  57. #                 <weapon_xstat: STAT x> , where STAT is th name of the new stat
  58. #
  59. #           Ex. <weapon_xstat: str 5> , would raise the actor's str +5
  60. #
  61. #  *For Scripters
  62. #
  63. #  -If you want to access the stats, just use:
  64. #                actor.xstat.STAT - Where STAT is the name of the new stat
  65. #          
  66. #           Ex. $game_actors[1].xstat.str , will return actor 1's str
  67. #  
  68. #===============================================================================
  69. # Credits:
  70. # -Nelderson and Zetu
  71. #  Original Script was made by Zetu, and I spiced the shit out of it!
  72. #===============================================================================

  73. module Z26

  74.   STATS = [:str,:con,:dex,:int,:wis,:cha]

  75.   #Default xstat formulas for ACTORS
  76.   DEFAULT_LEVEL_FORMULA =
  77.                 {
  78.                   :str => '(level/3.5) + 16 + atk',
  79.                   :con => '(level/5.6) + 12',
  80.                   :dex => '(level/5.25) + 15 + agi',
  81.                   :int => '(level/10.5) + 10',
  82.                   :wis => '(level/10.5) + 10',
  83.                   :cha => '(level/10.5) + 10',
  84.                 }

  85.   #Default xstat formulas for ENEMIES          
  86.   DEFAULT_FOR_ENEMIES =
  87.                 {
  88.                   :str => 0,
  89.                   :con => 0,
  90.                   :dex => 0,
  91.                   :int => 0,
  92.                   :wis => 0,
  93.                   :cha => 0,
  94.                 }

  95.    def self.actor_level_formulas(actor_id)
  96.           jhh = ""
  97.           strin = $data_actors[actor_id].get_start_end_cache
  98.           strin.each do |i|
  99.                 jhh += i
  100.           end
  101.           return DEFAULT_LEVEL_FORMULA if strin == "" or strin == []
  102.           return eval("{#{jhh}}")
  103.         end

  104.         def self.enemy_stats(enemy_id)
  105.           jhh = ""
  106.           strin = $data_enemies[enemy_id].get_start_end_cache
  107.           strin.each do |i|
  108.                 jhh += i
  109.           end
  110.           return DEFAULT_FOR_ENEMIES if strin == "" or strin == []
  111.           return eval("{#{jhh}}")
  112.         end

  113.   #=============================================================================
  114.   SYMBOLS = []
  115.   for stat in STATS
  116.         SYMBOLS.push(stat)
  117.   end
  118.   Xstats = Struct.new(*SYMBOLS)
  119. end

  120. class Game_Enemy < Game_Battler
  121.   attr_accessor :xstat

  122.   alias z26_enemy_set initialize unless $@
  123.   def initialize(*args)
  124.         z26_enemy_set(*args)
  125.         @xstat = Z26::Xstats.new(*([0]*Z26::STATS.size))
  126.         for stat in Z26::STATS
  127.           z26variate_stats(stat)
  128.         end
  129.   end

  130.   def z26variate_stats(stat)
  131.         return if Z26.enemy_stats(@enemy_id)[stat].nil?
  132.         if Z26.enemy_stats(@enemy_id)[stat].is_a?(String)
  133.           set_in = eval(Z26.enemy_stats(@enemy_id)[stat]).to_i
  134.           eval("@xstat.#{stat} += #{set_in}")
  135.         else
  136.           set_in = Z26.enemy_stats(@enemy_id)[stat]
  137.           @xstat[stat] += set_in
  138.         end
  139.   end
  140. end

  141. class Game_Actor < Game_Battler
  142.   attr_accessor :xstat

  143.   alias z26_s setup unless $@
  144.   def setup(actor_id)
  145.         z26_s(actor_id)
  146.         @xstat = Z26::Xstats.new(*([0]*Z26::STATS.size))
  147.         for item in equips.compact
  148.           z26variate_equip(item)
  149.         end
  150.         for stat in Z26::STATS
  151.           z26variate_stats(stat, @level)
  152.         end
  153.   end

  154.   alias z26_change_equip change_equip
  155.   def change_equip(equip_type, item, test = false)
  156.         last_item = equips[equip_type]
  157.         z26_change_equip(equip_type, item)
  158.         z26variate_equip(item)
  159.         z26variate_equip(last_item, false)
  160.   end

  161.   #=====================#
  162.   ##EDITED BY NELDERSON##
  163.   #=====================#
  164.   def z26variate_equip(item, adding = true)
  165.         return if item.nil?
  166.         for line in item.note.split(/[\r\n]+/).each{ |a|
  167.           case a
  168.           when /<weapon_xstat:[ ](.*)[ ](\d+)>/i
  169.                   if Z26::STATS.include?(eval(":" + $1))
  170.                         if adding
  171.                           eval("@xstat.#{$1} += #{$2}")
  172.                         else
  173.                         eval("@xstat.#{$1} -= #{$2}")
  174.                   end
  175.                 end
  176.           end
  177.           }
  178.         end
  179.   end

  180.   def z26variate_stats(stat, level, adding = true)
  181.         return if Z26.actor_level_formulas(@actor_id)[stat].nil?
  182.         if Z26.actor_level_formulas(@actor_id)[stat].is_a?(String)
  183.           amount = eval(Z26.actor_level_formulas(@actor_id)[stat]).to_i
  184.         else
  185.           amount = Z26.actor_level_formulas(@actor_id)[stat]
  186.         end
  187.         if adding
  188.           eval("@xstat.#{stat} += #{amount}")
  189.         else
  190.           eval("@xstat.#{stat} -= #{amount}")
  191.         end
  192.   end

  193.   alias z26level_up level_up unless $@
  194.   def level_up
  195.         for stat in Z26::STATS
  196.           z26variate_stats(stat, @level, false)
  197.         end
  198.         z26level_up
  199.         for stat in Z26::STATS
  200.           z26variate_stats(stat, @level)
  201.         end
  202.   end
  203. end

  204. class Window_Status < Window_Selectable
  205.   def draw_block3(y)
  206.         draw_parameters(0, y)
  207.         draw_equipments(344, y)#288
  208.         draw_xstat_parameters(172, y)
  209.   end

  210.   def draw_xstat_parameters(x, y)
  211.         @actor.xstat.size.times {|i|
  212.         draw_actor_xstat_param(@actor, x, y + line_height * i, i) }
  213.   end
  214. end

  215. class Window_Base < Window
  216.   def draw_actor_xstat_param(actor, x, y, param_id)
  217.         id = Z26::STATS[param_id]
  218.         change_color(system_color)
  219.         draw_text(x, y, 120, line_height, id.capitalize)
  220.         change_color(normal_color)
  221.         draw_text(x + 120, y, 36, line_height, actor.xstat[id], 2)
  222.   end
  223. end

  224. class RPG::BaseItem
  225.   def get_start_end_cache
  226.         record = false
  227.         temp = []
  228.         self.note.split(/[\r\n]+/).each do |line|
  229.           if line =~ /<xstat>/i
  230.                 record = true
  231.           elsif line =~ /<xstat_end>/i
  232.                 record = false
  233.           end
  234.           if record
  235.                 temp << line
  236.           end
  237.         end
  238.         return nil if temp == ""
  239.         temp.delete_at(0)
  240.         temp
  241.   end
  242. end
复制代码


原帖链接:
http://forums.rpgmakerweb.com/in ... -nasty-extra-stats/
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部