设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 132|回复: 0

[转载发布] N.A.S.T.Y Extra Stats

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-3 10:53:11 | 显示全部楼层 |阅读模式
    N.A.S.T.Y. Extra Stats(Version 1.1)





    By: Nelderson





    Updated: 3/27/12



    Introduction

    This script gives actors and enemies extra stats that you can use anywhere in your game!

    Features

    - New Stats for your game.

    - Define a formula for each new stat you make.

    - Use these new stats in skill formulas, or whatever else you feel like.

    - See your extra stats on the Status screen (Up to 6).

    - Equipment can increase these stats with a notetag.

    How to Use

    The instructions on the script itself has everything you need!

    Demo

    I'll make one if you guys want one!

    Script

    Spoiler#===============================================================================
    #                                                N.A.S.T.Y. Extra Stats
    #                                  Nelderson's Awesome Scripts To You
    # By: Nelderson
    # Made On: 12/19/2011
    # Last Updated : 3/27/2012
    #===============================================================================
    # Update History:
    # - Version 1.1  - Cleaned up some , and added enemies xstats for Enemies!
    # - Version 1.0  - Initial release, made for the  of it  

    #===============================================================================
    # *Notes:
    # - This script can be used to make all sorts of stats that can derive from
    #   an actor's level, and base stats.
    #
    # - This thing can be a pain to set up, but once it's done, it can be a very
    #   powerful way to include new stats into your game!
    #
    # - Made a quick edit to the status screen to show up to 6 stats!
    #
    # *Usage
    #
    # -First is the STATS section.  This is an array that holds all the new
    #  stats that everything else gets info from.
    #
    # - Next fill out the Default Level formula(Use Example Below as a guide)
    #   *ANYTHING that an actor has, you can base it off of (Except other XSTATS!)
    #           (level, hp, mp, atk, spi, agi, maxhp, etc.)
    #
    # -You can use the ACTOR and ENEMY NOTETAGS to customize
    #  the formulas for each actor.
    #
    #  Examples:
    #   Place the following in an actor's notebox(You must make one for each stat):
    #                 <xstat>
    #                 :str => '(level/3.5) + 16',
    #                 :con => '(level/5.6) + 12',
    #                 :dex => '(level/5.25) + 15 + agi',
    #                 :int => '(level/10.5) + 10',
    #                 :wis => '(level/10.5) + 10',
    #                 :cha => '(level/10.5) + 10',
    #                 <xstat_end>
    #
    #   Or you can place this in an actor's/enemy's notebox
    #                 <xstat>
    #                 :str => 15,
    #                 :con => 14,
    #                 :dex => 13,
    #                 :int => 12,
    #                 :wis => 11,
    #                 :cha => 0,
    #                 <xstat_end>
    #
    # - This script also uses notetags for weapons and armors to increase xstats
    #   if you want.  Just place in a notebox:
    #
    #                 <weapon_xstat: STAT x> , where STAT is th name of the new stat
    #
    #           Ex. <weapon_xstat: str 5> , would raise the actor's str +5
    #
    #  *For Scripters
    #
    #  -If you want to access the stats, just use:
    #                actor.xstat.STAT - Where STAT is the name of the new stat
    #          
    #           Ex. $game_actors[1].xstat.str , will return actor 1's str
    #  
    #===============================================================================
    # Credits:
    # -Nelderson and Zetu
    #  Original Script was made by Zetu, and I spiced the  out of it!
    #===============================================================================

    module Z26

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

      #Default xstat formulas for ACTORS
      DEFAULT_LEVEL_FORMULA =
                    {
                      :str => '(level/3.5) + 16 + atk',
                      :con => '(level/5.6) + 12',
                      :dex => '(level/5.25) + 15 + agi',
                      :int => '(level/10.5) + 10',
                      :wis => '(level/10.5) + 10',
                      :cha => '(level/10.5) + 10',
                    }

      #Default xstat formulas for ENEMIES          
      DEFAULT_FOR_ENEMIES =
                    {
                      :str => 0,
                      :con => 0,
                      :dex => 0,
                      :int => 0,
                      :wis => 0,
                      :cha => 0,
                    }

       def self.actor_level_formulas(actor_id)
              jhh = ""
              strin = $data_actors[actor_id].get_start_end_cache
              strin.each do |i|
                    jhh += i
              end
              return DEFAULT_LEVEL_FORMULA if strin == "" or strin == []
              return eval("{#{jhh}}")
            end

            def self.enemy_stats(enemy_id)
              jhh = ""
              strin = $data_enemies[enemy_id].get_start_end_cache
              strin.each do |i|
                    jhh += i
              end
              return DEFAULT_FOR_ENEMIES if strin == "" or strin == []
              return eval("{#{jhh}}")
            end

      #=============================================================================
      SYMBOLS = []
      for stat in STATS
            SYMBOLS.push(stat)
      end
      Xstats = Struct.new(*SYMBOLS)
    end

    class Game_Enemy < Game_Battler
      attr_accessor :xstat

      alias z26_enemy_set initialize unless $@
      def initialize(*args)
            z26_enemy_set(*args)
            @xstat = Z26::Xstats.new(*([0]*Z26::STATS.size))
            for stat in Z26::STATS
              z26variate_stats(stat)
            end
      end

      def z26variate_stats(stat)
            return if Z26.enemy_stats(@enemy_id)[stat].nil?
            if Z26.enemy_stats(@enemy_id)[stat].is_a?(String)
              set_in = eval(Z26.enemy_stats(@enemy_id)[stat]).to_i
              eval("@xstat.#{stat} += #{set_in}")
            else
              set_in = Z26.enemy_stats(@enemy_id)[stat]
              @xstat[stat] += set_in
            end
      end
    end

    class Game_Actor < Game_Battler
      attr_accessor :xstat

      alias z26_s setup unless $@
      def setup(actor_id)
            z26_s(actor_id)
            @xstat = Z26::Xstats.new(*([0]*Z26::STATS.size))
            for item in equips.compact
              z26variate_equip(item)
            end
            for stat in Z26::STATS
              z26variate_stats(stat, @level)
            end
      end

      alias z26_change_equip change_equip
      def change_equip(equip_type, item, test = false)
            last_item = equips[equip_type]
            z26_change_equip(equip_type, item)
            z26variate_equip(item)
            z26variate_equip(last_item, false)
      end

      #=====================#
      ##EDITED BY NELDERSON##
      #=====================#
      def z26variate_equip(item, adding = true)
            return if item.nil?
            for line in item.note.split(/[\r\n]+/).each{ |a|
              case a
              when /<weapon_xstat:[ ](.*)[ ](\d+)>/i
                      if Z26::STATS.include?(eval(":" + $1))
                            if adding
                              eval("@xstat.#{$1} += #{$2}")
                            else
                            eval("@xstat.#{$1} -= #{$2}")
                      end
                    end
              end
              }
            end
      end

      def z26variate_stats(stat, level, adding = true)
            return if Z26.actor_level_formulas(@actor_id)[stat].nil?
            if Z26.actor_level_formulas(@actor_id)[stat].is_a?(String)
              amount = eval(Z26.actor_level_formulas(@actor_id)[stat]).to_i
            else
              amount = Z26.actor_level_formulas(@actor_id)[stat]
            end
            if adding
              eval("@xstat.#{stat} += #{amount}")
            else
              eval("@xstat.#{stat} -= #{amount}")
            end
      end

      alias z26level_up level_up unless $@
      def level_up
            for stat in Z26::STATS
              z26variate_stats(stat, @level, false)
            end
            z26level_up
            for stat in Z26::STATS
              z26variate_stats(stat, @level)
            end
      end
    end

    class Window_Status < Window_Selectable
      def draw_block3(y)
            draw_parameters(0, y)
            draw_equipments(344, y)#288
            draw_xstat_parameters(172, y)
      end

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

    class Window_Base < Window
      def draw_actor_xstat_param(actor, x, y, param_id)
            id = Z26::STATS[param_id]
            change_color(system_color)
            draw_text(x, y, 120, line_height, id.capitalize)
            change_color(normal_color)
            draw_text(x + 120, y, 36, line_height, actor.xstat[id], 2)
      end
    end

    class RPG::BaseItem
      def get_start_end_cache
            record = false
            temp = []
            self.note.split(/[\r\n]+/).each do |line|
              if line =~ /<xstat>/i
                    record = true
              elsif line =~ /<xstat_end>/i
                    record = false
              end
              if record
                    temp << line
              end
            end
            return nil if temp == ""
            temp.delete_at(0)
            temp
      end
    end

                    Code:       
    [code][/code]





    FAQ

    Q: What does N.A.S.T.Y. stand for?

    A: Nelderson's Awesome Scripts to You!

    Credit and Thanks

    - Nelderson

    - Zetu, for her original script, and showing me the value of Structs <3


    本贴来自国际rpgmaker官方论坛作者:Nelderson处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/n-a-s-t-y-extra-stats.998/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 07:22 , Processed in 0.076521 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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