zero50

Villager
Member
Joined
Jan 27, 2014
Messages
71
Reaction score
1
First Language
Greek
Primarily Uses
Hi!

I've been using this script to make two extra stats:

One is only for enemies, and it's called LV (Level)  (Like the Actor one)

Enemies don't gain levels in this game,

I just needed them to have levels because my 

damage formula needs it.

The other stat is used by both actors and enemies, and it's called Attack.

For actors, this stats depends solely on weapons.

For enemies, every enemy has a standard value.

BUT- It seems the script can't do this.

Whatever extra stat you give to the enemy, you have to give to the actors.

So on the actor's status screen,I can see Level twice...

If I could at least make the value invisible on the status screen...

Any help would be great!

Here is the script:

Code:
#==============================================================================# Crystal Engine - Extra Stats#------------------------------------------------------------------------------# Current Version: 1.06#==============================================================================$imported ||= {}$imported["CE-ExtraStats"] = true=beginThis script allows for you to have additional stats for your battler. Those areviewable on the default status screen for your convinece. To use them in damageformulas use xstat.(stat abriviation).-------------------------------------------------------------------------------Notetags:Actor Notes<xstat> # Sets the xstat formulas up. This takes precidence over the class formulastat => formula, # Be sure to put a collon on the stats.</xstat_end> # The formula can be any valid ruby exprssion that returns a number.<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%Class Notes<xstat> # Sets the xstat formulas up.stat => formula, # Be sure to put a collon on the stats.</xstat_end> # The formula can be any valid ruby exprssion that returns a number.<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%Skill Notes<xstat growth: stat x> # Changes the specified stat by xItem Notes<xstat growth: stat x> # Changes the specified stat by xWeapon Notes<weapon_xstat: stat +x> # Sets the specified stat to be modified by x<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%Armor Notes<weapon_xstat: stat +x> # Sets the specified stat to be modified by x<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%Enemy Notes<xstat> # Sets the xstat formulas up. This takes precidence over the class formulastat => formula, # Be sure to put a collon on the stats.</xstat_end> # The formula can be any valid ruby exprssion that returns a number.<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%State Notes<state_xstat: stat x%> # Sets the specified stat to be multiplied by x%-------------------------------------------------------------------------------Script Calls:change_xstat(actor_id, stat, value) # Alter the specified stat by the specifed # value. Can be either positive or negative.=endmodule CRYSTAL  module XSTAT        STATS = [:str,:lvl]        #Default xstat formulas for ACTORS    DEFAULT_LEVEL_FORMULA = {      :str => '0',      :lvl => 'level',      }        #Default xstat formulas for ENEMIES	      DEFAULT_FOR_ENEMIES = {    :str => '0',               #'database_param(2)',    :lvl => '0',   # :str2 => '0'    }        TERMS = {    :str => "Attack",    :lvl => "LV",    }        STAT_MIN = {    :str => 0,    :lvl => 1,  # :str2 => 1    }        STAT_MAX = {    :str => 255,    :lvl => 99,   # :str2 => 255    }      endend#==============================================================================# Editing beyond this point may cause stone, zombie, mist frenzy, and/or toad,# so edit at your own risk.#==============================================================================#==============================================================================# ** RPG::BaseItem#------------------------------------------------------------------------------#  Superclass of actor, class, skill, item, weapon, armor, enemy, and state.#==============================================================================class RPG::BaseItem  #--------------------------------------------------------------------------  # * Extra Stat Formula  #--------------------------------------------------------------------------  def xstat_formula(stat)    return @xstat[stat] if @xstat && @xstat[stat]    @xstat ||= {}    xstats_defining = false    @note.split(/[\r\n]+/).each do |line|      case line      when /<XSTAT>/i        xstats_defining = true      when /<\/XSTAT_END>/i        xstats_defining = false      when /#{stat} => '(.*)',/i        next unless xstats_defining        @xstat[stat] = $1.to_s      end    end    if is_a?(RPG::Actor) || is_a?(RPG::Class)      @xstat[stat] ||= CRYSTAL::XSTAT::DEFAULT_LEVEL_FORMULA[stat]    else      @xstat[stat] ||= CRYSTAL::XSTAT::DEFAULT_FOR_ENEMIES[stat]    end    return @xstat[stat]  end  #--------------------------------------------------------------------------  # * Extra Stat Modifier  #--------------------------------------------------------------------------  def xstat_modifier(stat)    @note =~ /<STATE_XSTAT: #{stat} (\d+)([%%])>/i ? $1.to_i * 0.01 : 1.00  endend#==============================================================================# ** RPG::UsableItem#------------------------------------------------------------------------------#  The Superclass of Skill and Item.#==============================================================================class RPG::UsableItem < RPG::BaseItem  #--------------------------------------------------------------------------  # * Extra Stat Growth  #--------------------------------------------------------------------------  def xstat_growth(stat)    @note =~ /<XSTAT GROWTH: #{stat} (\d+)>/i ? $1.to_i : 0  endend#==============================================================================# ** RPG::EquipItem#------------------------------------------------------------------------------#  A superclass of weapons and armor.#==============================================================================class RPG::EquipItem < RPG::BaseItem  #--------------------------------------------------------------------------  # * Extra Stat Change  #--------------------------------------------------------------------------  def xstat_change(stat)    @note =~ /<WEAPON_XSTAT: #{stat} ([\+\-]\d+)>/i ? $1.to_i : 0  endend#==============================================================================# ** Xstats#------------------------------------------------------------------------------#  This class handles the player's extra stats.#==============================================================================class Xstats  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(battler)    @battler = battler  end  #--------------------------------------------------------------------------  # * Define the Stats  #--------------------------------------------------------------------------  CRYSTAL::XSTAT::STATS.each do |sym|    define_method(:"#{sym}") do      @battler.eval_stat(sym)    end  endend#==============================================================================# ** Game_BattlerBase#------------------------------------------------------------------------------#  This base class handles battlers. It mainly contains methods for calculating# parameters. It is used as a super class of the Game_Battler class.#==============================================================================class Game_BattlerBase  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :xstat_plus               # Additions to the xstats  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  alias init_ce_extra_stats initialize  def initialize    init_ce_extra_stats    @xstat_plus = {}    CRYSTAL::XSTAT::STATS.each do |stat|      @xstat_plus[stat] = 0    end  end  #--------------------------------------------------------------------------  # * Extra Stats Object  #--------------------------------------------------------------------------  def xstat    Xstats.new(self)  end  #--------------------------------------------------------------------------  # * Extra Stats Object  #--------------------------------------------------------------------------  def eval_stat(sym)    if actor?      if actor.xstat_formula(sym) == CRYSTAL::XSTAT::DEFAULT_LEVEL_FORMULA[sym]        stat = eval(self.class.xstat_formula(sym))      else        stat = eval(actor.xstat_formula(sym))      end      equips.compact.each do |equip|        stat += equip.xstat_change(sym)      end      stat += @xstat_plus[sym]      equips.compact.each do |equip|        stat *= equip.xstat_modifier(sym)      end      stat *= actor.xstat_modifier(sym)      stat *= self.class.xstat_modifier(sym)    elsif enemy?      if $imported["CE-EnemyClasses"]        if enemy.xstat_formula(sym) == CRYSTAL::XSTAT::DEFAULT_FOR_ENEMIES[sym]          stat = eval(self.class.xstat_formula(sym))        end      end      stat ||= eval(enemy.xstat_formula(sym))      if $imported["CE-EnemyEquips"]        equips.compact.each do |equip|          stat += equip.xstat_change(sym)        end        stat += @xstat_plus[sym]        equips.compact.each do |equip|          stat *= equip.xstat_modifier(sym)        end      end      stat *= enemy.xstat_modifier(sym)      stat *= self.class.xstat_modifier(sym) if $imported["CE-EnemyClasses"]    end    states.each do |state|      stat *= state.xstat_modifier(sym)    end    return [[CRYSTAL::XSTAT::STAT_MIN[sym], stat.round].max, CRYSTAL::XSTAT::STAT_MAX[sym]].min  endend#==============================================================================# ** Game_Battler#------------------------------------------------------------------------------#  A battler class with methods for sprites and actions added. This class # is used as a super class of the Game_Actor class and Game_Enemy class.#==============================================================================class Game_Battler < Game_BattlerBase  #--------------------------------------------------------------------------  # * Apply Effect of Skill/Item  #--------------------------------------------------------------------------  alias item_apply_ce_extra_stats item_apply  def item_apply(user, item)    item_apply_ce_extra_stats(user, item)    if @result.hit?      CRYSTAL::XSTAT::STATS.each do |stat|        @xstat_plus[stat] += item.xstat_growth(stat)      end    end  end  #--------------------------------------------------------------------------  # * Test Skill/Item Application  #    Used to determine, for example, if a character is already fully healed  #   and so cannot recover anymore.  #--------------------------------------------------------------------------  alias item_test_ce_extra_stats item_test  def item_test(user, item)    CRYSTAL::XSTAT::STATS.each do |stat|      max = CRYSTAL::XSTAT::STAT_MAX[stat]      return true if item.xstat_growth(stat) > 0 && eval_stat(stat) < max    end    return item_test_ce_extra_stats(user, item)  endend#==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------#  An interpreter for executing event commands. This class is used within the# Game_Map, Game_Troop, and Game_Event classes.#==============================================================================class Game_Interpreter  #--------------------------------------------------------------------------  # * Modify an Extra Stat  #--------------------------------------------------------------------------  def change_xstat(id, stat, value)    $game_actors[id].xstat_plus[stat] += value  endend#==============================================================================# ** Window_Base#------------------------------------------------------------------------------#  This is a super class of all windows within the game.#==============================================================================class Window_Base < Window  #--------------------------------------------------------------------------  # * Draw Parameters  #--------------------------------------------------------------------------  def draw_actor_xstat(actor, x, y, stat)    change_color(system_color)    draw_text(x, y, 120, line_height, CRYSTAL::XSTAT::TERMS[stat])    change_color(normal_color)    #draw_text(x + 120, y, 36, line_height, eval("actor.xstat.#{stat}"), 2)    draw_text(x + 120, y, 36, line_height, eval("actor.xstat.#{stat}"), 2)  endend#==============================================================================# ** Window_Status#------------------------------------------------------------------------------#  This window displays full status specs on the status screen.#==============================================================================class Window_Status < Window_Selectable  #--------------------------------------------------------------------------  # * Draw Block 3  #--------------------------------------------------------------------------  def draw_block3(y)    draw_parameters(0, y)    draw_equipments(344, y)    draw_xstat_parameters(172, y)  end  #--------------------------------------------------------------------------  # * Draw Extra Stats  #--------------------------------------------------------------------------  def draw_xstat_parameters(x, y)    dy = 0    CRYSTAL::XSTAT::STATS.each do |stat|      draw_actor_xstat(@actor, x, y + dy, stat)      dy += line_height    end  endend
 

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
For enemy levels, it'd be easier to use a script that's actually made for it. like >this< one

After that, just remove level from CE's Extra Stats and it looks like you should be good to go.
 

zero50

Villager
Member
Joined
Jan 27, 2014
Messages
71
Reaction score
1
First Language
Greek
Primarily Uses
Can I use the level stat of this script in damage formulas??

And if yes how?

EDIT:

I tried using enemy.level on the formula and it didn't work.

ANy ideas?
 
Last edited by a moderator:

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
I just tested and yes you can.  In the Skill's formula box, a.level refers to the level of the  battler that's attacking.  Make sure you save your project before testing in the troop tab's Battle Test.  If you're still not doing any damage, then it should be the result of whatever damage  formula you are using.
 

zero50

Villager
Member
Joined
Jan 27, 2014
Messages
71
Reaction score
1
First Language
Greek
Primarily Uses
Wow thanks it actually works!

:D

I never thought it would be the same code as for the actor battlers!
 

Latest Threads

Latest Posts

Latest Profile Posts

It's important to equip your GF.
vufFBXN.gif
Day 2 of my redesign journey, as a follow up from the previous post :kaothx:
pXiRJSm.jpg

This is Cedric's son, Apollo!
New pet peeve: Telling tech support personnel what something is doing, only for them to tell me (in excessively condescending tones) what it should be doing. Yes, I know what it should be doing, and if it was doing that, I wouldn’t be talking to you and your attitude problem about it right now, would I? >.<
uglywolf wrote on Khulse's profile.
Hello.
The rules I makes pun about on your last thread is about "Verify Files" before anything else, if the stuff comes from STEAM. Which means, if it could be fixed with just that, there is no need to redownload the whole stuff.
But glad the reinstall worked, hope you enjoy it and your days too.

Forum statistics

Threads
115,433
Messages
1,089,832
Members
150,193
Latest member
gjwldl97
Top