Nelderson 55 Posted December 20, 2011 (edited) 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 #=============================================================================== # 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 shit, and added enemies xstats for Enemies! # - Version 1.0 - Initial release, made for the shit 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 shit 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 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 Edited March 28, 2012 by Nelderson 4 PhoenixSoul, #tag this, sanggameboy and 1 other reacted to this Share this post Link to post Share on other sites
Rosenblack 79 Posted December 20, 2011 *Added to the Master Script List* Share this post Link to post Share on other sites
???nOBodY??? 30 Posted December 20, 2011 Meh, write me more codez. I'm too cheap to pay for Ace at its current price, and too lazy to bother with the "workarounds". Lol, jk. Life has a strange way of playing the thief. With rolls of 20 90% of the time. >.< 1 Rosenblack reacted to this Share this post Link to post Share on other sites
Super SaGa Soldier 6 Posted December 20, 2011 This sounds super duper awesome! I've always wanted a script to make extra stats. I know I'll have a use for this at some point... Just one question, how would you go about using these stats for anything? What determines what they do? Can they be used in skill formulas? How? Sorry for my ignorance. Share this post Link to post Share on other sites
Nelderson 55 Posted December 20, 2011 (edited) Of course they can be used in skill formulas! Lets say you wanted to make the damage based off "str", a new stat that you created: When you do the formula, it would be a.xstats.str (Remember, that in the skill formulas a = attacker, b = defender) And I can probably make a quick thing for enemies as well later on today if you want Edited December 20, 2011 by Nelderson Share this post Link to post Share on other sites
Super SaGa Soldier 6 Posted December 21, 2011 Okay! Sounds pretty cool. I'm sure I can figure out how to use them in formulas now. And yes, making extra stats for enemies too sounds wonderful! Share this post Link to post Share on other sites
Md'Targaryen 0 Posted January 12, 2012 I find a problem... Has a enemy got this "x"stats? My new "attack skill" has 'str' xstat in her formula: the monsters attack do zero damage points... [sorry, my English es bad XD] LOL Share this post Link to post Share on other sites
#tag this 1 Posted January 17, 2012 (edited) @Zorgotten: That's because the script only defines the extra stats for the actors at the moment, not the enemies. I'd like to see a version that applies to enemies as well. Edited January 17, 2012 by COTY 1 Md'Targaryen reacted to this Share this post Link to post Share on other sites
Cimmantti 0 Posted February 23, 2012 (edited) May I ask...what exactly does each new stat do? 'Cuz when I eventually buy Ace, this is definitely something I'd like to look into. Edited February 23, 2012 by Cimmantti Share this post Link to post Share on other sites
Hildi Nararya 0 Posted March 9, 2012 excuse me, can i ask something? when i try make ten extra stats and i used the tenth stats in my skill formula, when the skill hit the enemy it become nullified. I mean every skill that use the tenth stats in their formula cannot damage the enemy, maybe anyone can help? Share this post Link to post Share on other sites
Md'Targaryen 0 Posted March 24, 2012 I still hope an update in which the xstats could be used for the enemies. Share this post Link to post Share on other sites
Nelderson 55 Posted March 24, 2012 I'll sit down later on tonight and add the stats for enemies, it'll be really easy actually Share this post Link to post Share on other sites
Md'Targaryen 0 Posted March 27, 2012 thank you I think it is a good script Share this post Link to post Share on other sites
Nelderson 55 Posted March 27, 2012 Crap....I should actually update this.... I'll try again tonight! Share this post Link to post Share on other sites
Nelderson 55 Posted March 28, 2012 UPDATE: This script has been updated to Version 1.1 The new version includes xstats for enemies, as well as general cleanup with some of the code. As always, if you find any bugs, please report it here! 1 Rosenblack reacted to this Share this post Link to post Share on other sites
ToastyCheese 45 Posted March 29, 2012 I seem to be having an issue with this. The stats I create do not seem to have any bearing in the skill formulas and i'm getting allot of "does no damage." Share this post Link to post Share on other sites
Nelderson 55 Posted March 29, 2012 How do you have your skill formula set up? And how did you set up the actor/enemy with the stat? Share this post Link to post Share on other sites
ToastyCheese 45 Posted March 30, 2012 (edited) Well first off I wanted to use actor base stats which grow by level as more of a modifier and use the extra stats idea to create gear-specific stats of attack defense magic attack resist, so that these stats exist but are augmented primarily by gear instead of level. (AtkPwr, Defnse, MagPwr, Resist) I added appropriate tags to the weapons and armor i was testing (so i believe) Axe with: <weapon_xstat: AtkPwr 10> and tagged the enemy i was testing against with <xstat> :AtkPwr => 10, :Defnse => 5, :MagPwr => 8, :Resist => 3, <xstat_end> In addition to setting base stats. The basic attack formula was (a.AtkPwr) - (a.AtkPwr*(b.Defnse/100) Was trying to make it so that Defense acts as a direct percentile reduction in damage. If i was able to make that work I wanted to add in a tag for making the actual def stat (renamed to vit) act as an additional reduction but I didn't get that far. When i tested this similar formula out using the default attack / defense values instead of added stats it worked just fine. All i'm getting is allot of 0's though. Edited March 30, 2012 by Mascarpone Share this post Link to post Share on other sites
Nelderson 55 Posted March 30, 2012 The problem is your formula....it should be like this: (a.xstat.AtkPwr) - (a.xstat.AtkPwr*(b.Defnse/100) Any stat you custom make, should have xstat.STAT, where STAT is you custom stat. Tell me if this works for you Share this post Link to post Share on other sites
ToastyCheese 45 Posted March 30, 2012 (edited) ah. I must have missed the note about needing that tag in there. actually upon further inspection i don't see anything in the notes that say you need to tag new stats with .xstat in formulas. This might be obvious to some but I'm not very familiar with how RGSS works and it didn't occur to me that it would be necessary. Thank you for clearing that up though~ Edited March 30, 2012 by Mascarpone Share this post Link to post Share on other sites
Nelderson 55 Posted March 30, 2012 # *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 shit out of it! #=============================================================================== It's in there, near the bottom of the instructions I might need to write better documentation though....give me some time Share this post Link to post Share on other sites
Lyson 29 Posted April 2, 2012 Nelderson, is it possible to create a stat that governs player movement in battle? In the battle system I'm trying to put together for my project, I would like to have a stat (like Move) that determines how far an enemy or player can move across the screen. I don't even know if this is possible to do. I am also using Victor's Animated Battles. For reference, the inspiration from my battle system comes from the Lunar series, of course with my own modifications and tweaks to it. Share this post Link to post Share on other sites
Ghee 0 Posted April 13, 2012 Very nice script. By any chance, is there a way to make the default stats' value depends on extra stat value? Like every str+1 will increase the char's atk +1. I couldn't find how to do that in your instruction. Share this post Link to post Share on other sites
Ventwig 26 Posted April 13, 2012 I didn't find a use for this before, but earlier today, i was thinking "Hmm, my summons should have different stats from the actors..." And then i saw this! Just wondering, is there a way to rename stats? do you just change, let's say :str to :pow ? Thanks Share this post Link to post Share on other sites
Nelderson 55 Posted April 14, 2012 @Lyson - This script is just for extra stats....you still need to know how to use them for various things like your "movement". It's easy for someone to modify an existing script for use with xstats....it just requires the scripting knowledge! @Ghee - You would need to make a change to the battler class. Specifically the atk method, for the example you provided. Remember, this script just gives the actors extra stats. Doing other things requires you to understand how to use the stats in other parts of the game! @Anton - Absolutely! Try it out Share this post Link to post Share on other sites