¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.
Conectarse

Recuperar mi contraseña

Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Afiliados
Estadísticas
Tenemos 3396 miembros registrados.
El último usuario registrado es Discorded.

Nuestros miembros han publicado un total de 79808 mensajes en 11257 argumentos.
Navega con Google Chrome
[DESCARGA]

Error en un script (Extra Parameter Change) [Resuelto]

 :: RPG Maker :: Ayuda RPG

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker XP Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Lance Amano el 2014-08-04, 12:57

Tengo problemas con el siguiente script:

Código:
#------------------------------------------------------------------------------
    #  Extra Parameter Change (ver 1.0) [XP]
    # 
    #==============================================================================
    #  About
    #------------------------------------------------------------------------------
    #  Title: Extra Parameter Change XP
    #
    #  A script that allows the player to increase or decrease additional
    #    in game parameters. In version 1.0, these stats include:
    #      attack (atk)    physical defence (pdef)    magical defence (mdef)
    #      evasion (eva)
    #
    #
    #  Version: 1.0
    #      # 1.0 - Initial Release
    #     
    #  Date Published: 01 February 2013
    #  Last Updated  : 01 February 2012
    #  Author: Logan Forrests
    #  Hosted on: RMRK.net only.
    #
    #  Permissions for use of this script can be found here:
    #      - http://rmrk.net/index.php/topic,45481.0.html
    #
    #  Redistribution of this script is stricly prohibited with prior permission.
    #==============================================================================
    #  Directions
    #------------------------------------------------------------------------------
    #    Items which are designed to increase or decrease any of these additional
    #    parameters must be defined under BATTLE_STAT_ITEMS. The ID of the item
    #    is required and is used to check if the item being used is one that will
    #    modify the base parameter.
    #    Follow the example provided in the relevant section to set up items that
    #    will have the desired effect of modifying these extra parameters.
    #
    #  A maximum bonus can also be set for each extra parameter. By default,
    #    these values have been set to 999.
    #==============================================================================
    module LFXP
      module STAT_PLUS
        #------------------------------------------------------------------------
        # * Set which items change these parameters
        #------------------------------------------------------------------------
        BATTLE_STAT_ITEMS = {  #Do Not Remove
        # Item ID  =>  {:atk => #, :pdef => #, :mdef => #, :eva => #},
        #
        # Ex. To make Item ID 35 increase ATK by 5:
        #    35    =>  {:atk => 5, :pdef => 0, :mdef => 0, :eva => 0},
        # Insert your items in the space below:
          24    =>  {:atk => 10, :pdef => 0, :mdef => 0, :eva => 0},
          25    =>  {:atk => 0, :pdef => 10, :mdef => 0, :eva => 0},
          26    =>  {:atk => 0, :pdef => 0, :mdef => 10, :eva => 0},
          27    =>  {:atk => 0, :pdef => 0, :mdef => 0, :eva => 10},
        } #Do Not Remove
        #------------------------------------------------------------------------
        # * Maximum bonus attainable for each parameter type
        #------------------------------------------------------------------------
        MAX_BONUS = {  # Do Not Remove
          :atk    =>  999,
          :pdef  =>  999,
          :mdef  =>  999,
          :eva    =>  999,
        } #Do Not Remove
      end
   
    end
    #==============================================================================
    #  DO NOT EDIT BELOW THIS LINE  ::::::::::::::: DO NOT EDIT BELOW THIS LINE  #
    #==============================================================================
    $imported ||= {}
    $imported[:lfxp_statplus] = true
    #==============================================================================
    # ** Game_Battler
    #==============================================================================
    class Game_Battler
      #--------------------------------------------------------------------------
      # * Base Class attr_readers for extra stat bonuses
      #    Prevents errors from no method defined in base class use
      #--------------------------------------------------------------------------
      def lfxp_sp_atk;  0; end
      def lfxp_sp_dpef; 0; end
      def lfxp_sp_mdef; 0; end
      def lfxp_sp_eva;  0; end
      def lfxp_sp_statplus(*args); 0; end
      #--------------------------------------------------------------------------
      # * Application of Item Effects
      #    item : item
      #--------------------------------------------------------------------------
      alias lfxp_statplus_itmeff_gb_lk93 item_effect
      def item_effect(item, *args, &block)
        #Set effective flag to false (ie. has a change occured in stat)
        effective = false
        #If item is a stat boost item as defined in LFXP::STAT_PLUS config
        boost = LFXP::STAT_PLUS::BATTLE_STAT_ITEMS[item.id]
        if boost
          boost.each_pair do |s, v|
            #Take result of changing the stat
            result = lfxp_sp_statplus(s, v)
            # if result is true, then stat_changed is true
            #  once stat_changed is true, it will remain true despite result
            if result then effective = true end
          end
        end
        return (lfxp_statplus_itmeff_gb_lk93(item, *args, &block) or effective)
      end
   
    end
    #==============================================================================
    # ** Game_Actor
    #==============================================================================
    class Game_Actor < Game_Battler
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias lfxp_statplus_init_ga_aqwq initialize
      def initialize(*args, &block)
        #Create new varaibles for holding base stat bonus for atk, pdef, mdef, eva
        @lfxp_sp_base = [0, 0, 0, 0]
        #run original method
        lfxp_statplus_init_ga_aqwq(*args, &block)
      end
      #--------------------------------------------------------------------------
      # * Base Class attr_readers for extra stat bonuses
      #    Prevents errors from no method defined in base class use
      #--------------------------------------------------------------------------
      def lfxp_sp_atk;  @lfxp_sp_base[0];  end    #ATK
      def lfxp_sp_pdef; @lfxp_sp_base[1];  end    #PDEF
      def lfxp_sp_mdef; @lfxp_sp_base[2];  end    #MDEF
      def lfxp_sp_eva;  @lfxp_sp_base[3];  end    #EVA 
      #--------------------------------------------------------------------------
      # * Stat Plus method
      #    Increases or decreases appropriate stats
      #    Returns true if a parameter change occurs, false if not
      #--------------------------------------------------------------------------
      def lfxp_sp_statplus(stat, value)
        #Change  the relative value
        case stat
        when :atk
          orig_value = lfxp_sp_atk #original attack
          @lfxp_sp_base[0] = [[lfxp_sp_atk + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:atk].min
          return true if orig_value != lfxp_sp_atk
        when :pdef
          orig_value = lfxp_sp_pdef #original pdef
          @lfxp_sp_base[1] = [[lfxp_sp_pdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:pdef].min
          return true if orig_value != lfxp_sp_pdef
        when :mdef
          orig_value = lfxp_sp_mdef #original mdef
          @lfxp_sp_base[2] = [[lfxp_sp_mdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:mdef].min
          return true if orig_value != lfxp_sp_mdef
        when :eva
          orig_value = lfxp_sp_eva #original eva
          @lfxp_sp_base[3] = [[lfxp_sp_eva + value, 0].max, LFXP::STAT_PLUS::MAX_BONUSeva].min
          return true if orig_value != lfxp_sp_eva
        end
        #In all cases, or when no case
        return false #not effective
      end
      #--------------------------------------------------------------------------
      # * Sub class method definitions.
      #    Also retrieves value from Superclass in case changes are added
      #    By default, all super values are 0
      #--------------------------------------------------------------------------
      def base_atk
        super + lfxp_sp_atk
      end
   
      def base_pdef
        super + lfxp_sp_pdef
      end
   
      def base_mdef
        super + lfxp_sp_mdef
      end
   
      def base_eva
        super + lfxp_sp_eva
      end
   
    end






Tan pronto como empiezo a testear mi projecto, me tira este error:



El cuál se refiere a esta parte del script:

Código:
return true if orig_value != lfxp_sp_atk





¿Qué puede estar causando la falla?


Última edición por Lance Amano el 2014-08-04, 21:25, editado 1 vez

Lance Amano
Soñador
Soñador

0/3

Créditos 163

Gracias : 13

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Wecoc el 2014-08-04, 14:02

Era porque faltaba un paréntesis en la línea anterior. Los SyntaxError suelen ser por cosas así.

Ese script no me gusta, tiene cosas bastante extrañas, pero en fin... Aquí está con los paréntesis que tocan, a ver si ahora te va todo bien:

Código:
#------------------------------------------------------------------------------
#  Extra Parameter Change (ver 1.0) [XP]
#
#==============================================================================
#  About
#------------------------------------------------------------------------------
#  Title: Extra Parameter Change XP
#
#  A script that allows the player to increase or decrease additional
#    in game parameters. In version 1.0, these stats include:
#      attack (atk)    physical defence (pdef)    magical defence (mdef)
#      evasion (eva)
#
#
#  Version: 1.0
#      # 1.0 - Initial Release
#   
#  Date Published: 01 February 2013
#  Last Updated  : 01 February 2012
#  Author: Logan Forrests
#  Hosted on: RMRK.net only.
#
#  Permissions for use of this script can be found here:
#      - http://rmrk.net/index.php/topic,45481.0.html
#
#  Redistribution of this script is stricly prohibited with prior permission.
#==============================================================================
#  Directions
#------------------------------------------------------------------------------
#    Items which are designed to increase or decrease any of these additional
#    parameters must be defined under BATTLE_STAT_ITEMS. The ID of the item
#    is required and is used to check if the item being used is one that will
#    modify the base parameter.
#    Follow the example provided in the relevant section to set up items that
#    will have the desired effect of modifying these extra parameters.
#
#  A maximum bonus can also be set for each extra parameter. By default,
#    these values have been set to 999.
#==============================================================================
module LFXP
  module STAT_PLUS
    #------------------------------------------------------------------------
    # * Set which items change these parameters
    #------------------------------------------------------------------------
    BATTLE_STAT_ITEMS = {  #Do Not Remove
    # Item ID  =>  {:atk => #, :pdef => #, :mdef => #, :eva => #},
    #
    # Ex. To make Item ID 35 increase ATK by 5:
    #    35    =>  {:atk => 5, :pdef => 0, :mdef => 0, :eva => 0},
    # Insert your items in the space below:
      24    =>  {:atk => 10, :pdef => 0, :mdef => 0, :eva => 0},
      25    =>  {:atk => 0, :pdef => 10, :mdef => 0, :eva => 0},
      26    =>  {:atk => 0, :pdef => 0, :mdef => 10, :eva => 0},
      27    =>  {:atk => 0, :pdef => 0, :mdef => 0, :eva => 10},
    } #Do Not Remove
    #------------------------------------------------------------------------
    # * Maximum bonus attainable for each parameter type
    #------------------------------------------------------------------------
    MAX_BONUS = {  # Do Not Remove
      :atk    =>  999,
      :pdef  =>  999,
      :mdef  =>  999,
      :eva    =>  999,
    } #Do Not Remove
  end

end
#==============================================================================
#  DO NOT EDIT BELOW THIS LINE  ::::::::::::::: DO NOT EDIT BELOW THIS LINE  #
#==============================================================================
$imported ||= {}
$imported[:lfxp_statplus] = true
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  0; end
  def lfxp_sp_dpef; 0; end
  def lfxp_sp_mdef; 0; end
  def lfxp_sp_eva;  0; end
  def lfxp_sp_statplus(*args); 0; end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #    item : item
  #--------------------------------------------------------------------------
  alias lfxp_statplus_itmeff_gb_lk93 item_effect
  def item_effect(item, *args, &block)
    #Set effective flag to false (ie. has a change occured in stat)
    effective = false
    #If item is a stat boost item as defined in LFXP::STAT_PLUS config
    boost = LFXP::STAT_PLUS::BATTLE_STAT_ITEMS[item.id]
    if boost
      boost.each_pair do |s, v|
        #Take result of changing the stat
        result = lfxp_sp_statplus(s, v)
        # if result is true, then stat_changed is true
        #  once stat_changed is true, it will remain true despite result
        if result then effective = true end
      end
    end
    return (lfxp_statplus_itmeff_gb_lk93(item, *args, &block) or effective)
  end

end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias lfxp_statplus_init_ga_aqwq initialize
  def initialize(*args, &block)
    #Create new varaibles for holding base stat bonus for atk, pdef, mdef, eva
    @lfxp_sp_base = [0, 0, 0, 0]
    #run original method
    lfxp_statplus_init_ga_aqwq(*args, &block)
  end
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  @lfxp_sp_base[0];  end    #ATK
  def lfxp_sp_pdef; @lfxp_sp_base[1];  end    #PDEF
  def lfxp_sp_mdef; @lfxp_sp_base[2];  end    #MDEF
  def lfxp_sp_eva;  @lfxp_sp_base[3];  end    #EVA
  #--------------------------------------------------------------------------
  # * Stat Plus method
  #    Increases or decreases appropriate stats
  #    Returns true if a parameter change occurs, false if not
  #--------------------------------------------------------------------------
  def lfxp_sp_statplus(stat, value)
    #Change  the relative value
    case stat
    when :atk
      orig_value = lfxp_sp_atk #original attack
      @lfxp_sp_base[0] = [[lfxp_sp_atk + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:atk]].min
      return true if orig_value != lfxp_sp_atk
    when :pdef
      orig_value = lfxp_sp_pdef #original pdef
      @lfxp_sp_base[1] = [[lfxp_sp_pdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:pdef]].min
      return true if orig_value != lfxp_sp_pdef
    when :mdef
      orig_value = lfxp_sp_mdef #original mdef
      @lfxp_sp_base[2] = [[lfxp_sp_mdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:mdef]].min
      return true if orig_value != lfxp_sp_mdef
    when :eva
      orig_value = lfxp_sp_eva #original eva
      @lfxp_sp_base[3] = [[lfxp_sp_eva + value, 0].max, LFXP::STAT_PLUS::MAX_BONUSeva].min
      return true if orig_value != lfxp_sp_eva
    end
    #In all cases, or when no case
    return false #not effective
  end
  #--------------------------------------------------------------------------
  # * Sub class method definitions.
  #    Also retrieves value from Superclass in case changes are added
  #    By default, all super values are 0
  #--------------------------------------------------------------------------
  def base_atk
    super + lfxp_sp_atk
  end

  def base_pdef
    super + lfxp_sp_pdef
  end

  def base_mdef
    super + lfxp_sp_mdef
  end

  def base_eva
    super + lfxp_sp_eva
  end

end


Wecoc
Administrador
Administrador



Créditos 8272

Gracias : 372

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Lance Amano el 2014-08-04, 14:52

Lo testeé otra vez y ahora me sale este error cuando intento usar los items creados:



Wecoc escribió:Ese script no me gusta, tiene cosas bastante extrañas, pero en fin... Aquí está con los paréntesis que tocan, a ver si ahora te va todo bien:


El tipo quien creó este script dijo no tener mucha experiencia con el XP ya que el trabaja mayormente con el VX/ACE. Tal vez sea por eso que el script presenta estos problemas.

Lance Amano
Soñador
Soñador

0/3

Créditos 163

Gracias : 13

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Wecoc el 2014-08-04, 18:37

Nunca entenderé que haya éste tipo de errores en scripts subidos, ¿eso significa que el que lo hizo no lo testeó? En fin, es que creo que confundió super con un alias, supongo que será eso.

No puedo probarlo yo mismo en éste momento pero a ver si así te va bien de una vez por todas:

Código:
#------------------------------------------------------------------------------
#  Extra Parameter Change (ver 1.0) [XP]
#
#==============================================================================
#  About
#------------------------------------------------------------------------------
#  Title: Extra Parameter Change XP
#
#  A script that allows the player to increase or decrease additional
#    in game parameters. In version 1.0, these stats include:
#      attack (atk)    physical defence (pdef)    magical defence (mdef)
#      evasion (eva)
#
#
#  Version: 1.0
#      # 1.0 - Initial Release
#   
#  Date Published: 01 February 2013
#  Last Updated  : 01 February 2012
#  Author: Logan Forrests
#  Hosted on: RMRK.net only.
#
#  Permissions for use of this script can be found here:
#      - http://rmrk.net/index.php/topic,45481.0.html
#
#  Redistribution of this script is stricly prohibited with prior permission.
#==============================================================================
#  Directions
#------------------------------------------------------------------------------
#    Items which are designed to increase or decrease any of these additional
#    parameters must be defined under BATTLE_STAT_ITEMS. The ID of the item
#    is required and is used to check if the item being used is one that will
#    modify the base parameter.
#    Follow the example provided in the relevant section to set up items that
#    will have the desired effect of modifying these extra parameters.
#
#  A maximum bonus can also be set for each extra parameter. By default,
#    these values have been set to 999.
#==============================================================================
module LFXP
  module STAT_PLUS
    #------------------------------------------------------------------------
    # * Set which items change these parameters
    #------------------------------------------------------------------------
    BATTLE_STAT_ITEMS = {  #Do Not Remove
    # Item ID  =>  {:atk => #, :pdef => #, :mdef => #, :eva => #},
    #
    # Ex. To make Item ID 35 increase ATK by 5:
    #    35    =>  {:atk => 5, :pdef => 0, :mdef => 0, :eva => 0},
    # Insert your items in the space below:
      24    =>  {:atk => 10, :pdef => 0, :mdef => 0, :eva => 0},
      25    =>  {:atk => 0, :pdef => 10, :mdef => 0, :eva => 0},
      26    =>  {:atk => 0, :pdef => 0, :mdef => 10, :eva => 0},
      27    =>  {:atk => 0, :pdef => 0, :mdef => 0, :eva => 10},
    } #Do Not Remove
    #------------------------------------------------------------------------
    # * Maximum bonus attainable for each parameter type
    #------------------------------------------------------------------------
    MAX_BONUS = {  # Do Not Remove
      :atk    =>  999,
      :pdef  =>  999,
      :mdef  =>  999,
      :eva    =>  999,
    } #Do Not Remove
  end

end
#==============================================================================
#  DO NOT EDIT BELOW THIS LINE  ::::::::::::::: DO NOT EDIT BELOW THIS LINE  #
#==============================================================================
$imported ||= {}
$imported[:lfxp_statplus] = true
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  0; end
  def lfxp_sp_dpef; 0; end
  def lfxp_sp_mdef; 0; end
  def lfxp_sp_eva;  0; end
  def lfxp_sp_statplus(*args); 0; end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #    item : item
  #--------------------------------------------------------------------------
  alias lfxp_statplus_itmeff_gb_lk93 item_effect unless $@
  def item_effect(item, *args, &block)
    #Set effective flag to false (ie. has a change occured in stat)
    effective = false
    #If item is a stat boost item as defined in LFXP::STAT_PLUS config
    boost = LFXP::STAT_PLUS::BATTLE_STAT_ITEMS[item.id]
    if boost
      boost.each_pair do |s, v|
        #Take result of changing the stat
        result = lfxp_sp_statplus(s, v)
        # if result is true, then stat_changed is true
        #  once stat_changed is true, it will remain true despite result
        if result then effective = true end
      end
    end
    return (lfxp_statplus_itmeff_gb_lk93(item, *args, &block) or effective)
  end

end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias lfxp_statplus_init_ga_aqwq initialize unless $@
  def initialize(*args, &block)
    #Create new varaibles for holding base stat bonus for atk, pdef, mdef, eva
    @lfxp_sp_base = [0, 0, 0, 0]
    #run original method
    lfxp_statplus_init_ga_aqwq(*args, &block)
  end
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  @lfxp_sp_base[0];  end    #ATK
  def lfxp_sp_pdef; @lfxp_sp_base[1];  end    #PDEF
  def lfxp_sp_mdef; @lfxp_sp_base[2];  end    #MDEF
  def lfxp_sp_eva;  @lfxp_sp_base[3];  end    #EVA
  #--------------------------------------------------------------------------
  # * Stat Plus method
  #    Increases or decreases appropriate stats
  #    Returns true if a parameter change occurs, false if not
  #--------------------------------------------------------------------------
  def lfxp_sp_statplus(stat, value)
    #Change  the relative value
    case stat
    when :atk
      orig_value = lfxp_sp_atk #original attack
      @lfxp_sp_base[0] = [[lfxp_sp_atk + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:atk]].min
      return true if orig_value != lfxp_sp_atk
    when :pdef
      orig_value = lfxp_sp_pdef #original pdef
      @lfxp_sp_base[1] = [[lfxp_sp_pdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:pdef]].min
      return true if orig_value != lfxp_sp_pdef
    when :mdef
      orig_value = lfxp_sp_mdef #original mdef
      @lfxp_sp_base[2] = [[lfxp_sp_mdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:mdef]].min
      return true if orig_value != lfxp_sp_mdef
    when :eva
      orig_value = lfxp_sp_eva #original eva
      @lfxp_sp_base[3] = [[lfxp_sp_eva + value, 0].max, LFXP::STAT_PLUS::MAX_BONUSeva].min
      return true if orig_value != lfxp_sp_eva
    end
    #In all cases, or when no case
    return false #not effective
  end
  #--------------------------------------------------------------------------
  # * Sub class method definitions.
  #    Also retrieves value from Superclass in case changes are added
  #    By default, all super values are 0
  #--------------------------------------------------------------------------
  unless $@
    alias default_base_atk base_atk
    alias default_base_pdef base_pdef
    alias default_base_mdef base_mdef
    alias default_base_eva base_eva
  end
 
  def base_atk
    atk = default_base_atk
    return atk + lfxp_sp_atk
  end

  def base_pdef
    pdef = default_base_pdef
    return pdef + lfxp_sp_pdef
  end

  def base_mdef
    mdef = default_base_mdef
    return mdef + lfxp_sp_mdef
  end

  def base_eva
    eva = default_base_eva
    return eva + lfxp_sp_eva
  end
end



Wecoc
Administrador
Administrador



Créditos 8272

Gracias : 372

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Lance Amano el 2014-08-04, 19:03

Lo testeé una vez más y... bien:



 Grito 

Wecoc escribió:Nunca entenderé que haya éste tipo de errores en scripts subidos, ¿eso significa que el que lo hizo no lo testeó?


Lo más probable es que el autor pensó que quien usaría el script haría el testeo por él, y él solamente se dedicaría a arreglar todos los errores que pudieran aparecer. No es la prímera vez que veo algo así.

Lance Amano
Soñador
Soñador

0/3

Créditos 163

Gracias : 13

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Wecoc el 2014-08-04, 20:45

No desesperes, da error en sitios distintos cada vez, por lo tanto todos los errores que vas encontrando los voy arreglando; eso significa que tarde o temprano llegaremos a un script funcional.

Código:
#------------------------------------------------------------------------------
#  Extra Parameter Change (ver 1.0) [XP]
#
#==============================================================================
#  About
#------------------------------------------------------------------------------
#  Title: Extra Parameter Change XP
#
#  A script that allows the player to increase or decrease additional
#    in game parameters. In version 1.0, these stats include:
#      attack (atk)    physical defence (pdef)    magical defence (mdef)
#      evasion (eva)
#
#
#  Version: 1.0
#      # 1.0 - Initial Release

#  Date Published: 01 February 2013
#  Last Updated  : 01 February 2012
#  Author: Logan Forrests
#  Hosted on: RMRK.net only.
#
#  Permissions for use of this script can be found here:
#      - http://rmrk.net/index.php/topic,45481.0.html
#
#  Redistribution of this script is stricly prohibited with prior permission.
#==============================================================================
#  Directions
#------------------------------------------------------------------------------
#    Items which are designed to increase or decrease any of these additional
#    parameters must be defined under BATTLE_STAT_ITEMS. The ID of the item
#    is required and is used to check if the item being used is one that will
#    modify the base parameter.
#    Follow the example provided in the relevant section to set up items that
#    will have the desired effect of modifying these extra parameters.
#
#  A maximum bonus can also be set for each extra parameter. By default,
#    these values have been set to 999.
#==============================================================================
module LFXP
  module STAT_PLUS
    #------------------------------------------------------------------------
    # * Set which items change these parameters
    #------------------------------------------------------------------------
    BATTLE_STAT_ITEMS = {  #Do Not Remove
    # Item ID  =>  {:atk => #, :pdef => #, :mdef => #, :eva => #},
    #
    # Ex. To make Item ID 35 increase ATK by 5:
    #    35    =>  {:atk => 5, :pdef => 0, :mdef => 0, :eva => 0},
    # Insert your items in the space below:
      24    =>  {:atk => 10, :pdef => 0, :mdef => 0, :eva => 0},
      25    =>  {:atk => 0, :pdef => 10, :mdef => 0, :eva => 0},
      26    =>  {:atk => 0, :pdef => 0, :mdef => 10, :eva => 0},
      27    =>  {:atk => 0, :pdef => 0, :mdef => 0, :eva => 10},
    } #Do Not Remove
    #------------------------------------------------------------------------
    # * Maximum bonus attainable for each parameter type
    #------------------------------------------------------------------------
    MAX_BONUS = {  # Do Not Remove
      :atk    =>  999,
      :pdef  =>  999,
      :mdef  =>  999,
      :eva    =>  999,
    } #Do Not Remove
  end

end
#==============================================================================
#  DO NOT EDIT BELOW THIS LINE  ::::::::::::::: DO NOT EDIT BELOW THIS LINE  #
#==============================================================================
$imported ||= {}
$imported[:lfxp_statplus] = true
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  0; end
  def lfxp_sp_dpef; 0; end
  def lfxp_sp_mdef; 0; end
  def lfxp_sp_eva;  0; end
  def lfxp_sp_statplus(*args); 0; end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #    item : item
  #--------------------------------------------------------------------------
  alias lfxp_statplus_itmeff_gb_lk93 item_effect unless $@
  def item_effect(item, *args, &block)
    #Set effective flag to false (ie. has a change occured in stat)
    effective = false
    #If item is a stat boost item as defined in LFXP::STAT_PLUS config
    boost = LFXP::STAT_PLUS::BATTLE_STAT_ITEMS[item.id]
    if boost
      boost.each_pair do |s, v|
        #Take result of changing the stat
        result = lfxp_sp_statplus(s, v)
        # if result is true, then stat_changed is true
        #  once stat_changed is true, it will remain true despite result
        if result then effective = true end
      end
    end
    return (lfxp_statplus_itmeff_gb_lk93(item, *args, &block) or effective)
  end

end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias lfxp_statplus_init_ga_aqwq initialize unless $@
  def initialize(*args, &block)
    #Create new varaibles for holding base stat bonus for atk, pdef, mdef, eva
    @lfxp_sp_base = [0, 0, 0, 0]
    #run original method
    lfxp_statplus_init_ga_aqwq(*args, &block)
  end
  #--------------------------------------------------------------------------
  # * Base Class attr_readers for extra stat bonuses
  #    Prevents errors from no method defined in base class use
  #--------------------------------------------------------------------------
  def lfxp_sp_atk;  @lfxp_sp_base[0];  end    #ATK
  def lfxp_sp_pdef; @lfxp_sp_base[1];  end    #PDEF
  def lfxp_sp_mdef; @lfxp_sp_base[2];  end    #MDEF
  def lfxp_sp_eva;  @lfxp_sp_base[3];  end    #EVA
  #--------------------------------------------------------------------------
  # * Stat Plus method
  #    Increases or decreases appropriate stats
  #    Returns true if a parameter change occurs, false if not
  #--------------------------------------------------------------------------
  def lfxp_sp_statplus(stat, value)
    #Change  the relative value
    case stat
    when :atk
      orig_value = lfxp_sp_atk #original attack
      @lfxp_sp_base[0] = [[lfxp_sp_atk + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:atk]].min
      return true if orig_value != lfxp_sp_atk
    when :pdef
      orig_value = lfxp_sp_pdef #original pdef
      @lfxp_sp_base[1] = [[lfxp_sp_pdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:pdef]].min
      return true if orig_value != lfxp_sp_pdef
    when :mdef
      orig_value = lfxp_sp_mdef #original mdef
      @lfxp_sp_base[2] = [[lfxp_sp_mdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:mdef]].min
      return true if orig_value != lfxp_sp_mdef
    when :eva
      orig_value = lfxp_sp_eva #original eva
      @lfxp_sp_base[3] = [[lfxp_sp_eva + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:eva]].min
      return true if orig_value != lfxp_sp_eva
    end
    #In all cases, or when no case
    return false #not effective
  end
  #--------------------------------------------------------------------------
  # * Sub class method definitions.
  #    Also retrieves value from Superclass in case changes are added
  #    By default, all super values are 0
  #--------------------------------------------------------------------------
  unless $@
    alias default_base_atk base_atk
    alias default_base_pdef base_pdef
    alias default_base_mdef base_mdef
    alias default_base_eva base_eva
  end
 
  def base_atk
    atk = default_base_atk
    return atk + lfxp_sp_atk
  end

  def base_pdef
    pdef = default_base_pdef
    return pdef + lfxp_sp_pdef
  end

  def base_mdef
    mdef = default_base_mdef
    return mdef + lfxp_sp_mdef
  end

  def base_eva
    eva = default_base_eva
    return eva + lfxp_sp_eva
  end
end



Espero que ésta vez sea el bueno.

Wecoc
Administrador
Administrador



Créditos 8272

Gracias : 372

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Mukadelheid el 2014-08-04, 21:17



  • Le faltan símbolos. ( ] , ])

  • Las lineas finales intentan llamar al método "base_atk" dentro de la "superclass" ; "Game_Battler", pero en esta clase no existen métodos llamados así.
    Pero , los que contienen los datos requeridos son similares ; "atk , def, mdef..."
    El creador se debe haber confundido con los nombres de los métodos. Es solo eso.


Pones los símbolos faltantes (cosa que al parecer has hecho) , y cambias el nombre a los métodos del final.


Última edición por Mukadelheid el 2014-08-04, 21:24, editado 2 veces

Mukadelheid
Principiante
Principiante

0/3

Créditos 331

Gracias : 28

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Lance Amano el 2014-08-04, 21:22

Por fin! Lo testeé y ahora funciona cómo debió desde un principio.

Muchas gracias, Wecoc!  Very Happy

Lance Amano
Soñador
Soñador

0/3

Créditos 163

Gracias : 13

Volver arriba Ir abajo

RPG Maker XP Re: Error en un script (Extra Parameter Change) [Resuelto]

Mensaje por Contenido patrocinado Hoy a las 06:56


Contenido patrocinado


Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


 :: RPG Maker :: Ayuda RPG

Permisos de este foro:
No puedes responder a temas en este foro.