Customised script bug - Runic Enchantment+Passive States not loading from game save.

Status
Not open for further replies.

LeeOccleshaw

Stone Dragon Workshop
Veteran
Joined
Jun 9, 2015
Messages
155
Reaction score
82
First Language
English
Primarily Uses
An error that has developed from my topic here: http://forums.rpgmakerweb.com/index.php?/topic/44058-runic-enchantment-and-yanfly-passive-states/

I've hit a wall in my development as I've just realised that the added (Yanfly) Passive States from Moogle_X's edit of Runic Enchantment (Kread Ex) do not actually load from my save files and do not appear again on the character until you unequip one and equip it again. 

I am guessing that either the passive states aren't being saved at all when saving the game or that they're not initialising when the game loads but I have no idea which or how to even begin fixing this problem as I'm not a scripter.

Original Scripts

Runic Enchantment: https://grimoirecastle.wordpress.com/rgss3-scripts/gameplay-scripts/runic-enchantment/comment-page-1/

Passive States: https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/passive-states/

Moogle_X then gave me these edits which are designed to add the passive state notetag functionality on the runes.

Passive States (Moogle_X edit)

#==============================================================================
#
# ▼ Yanfly Engine Ace - Passive States v1.02
# -- Last Updated: 2012.01.23
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-PassiveStates"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.23 - Compatibility Update: Doppelganger
# 2012.01.08 - Added passive state checks for adding/removing states.
# 2011.12.14 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows for actors, classes, weapons, armours, and enemies to have
# passives that are based off of states. Passive states will be active at all
# times and are immune to restrictions and will only disappear if the battler
# dies. Once the battler revives, the passives will return.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This will cause state x to be always on (unless the battler is dead). To have
# multiple passives, insert multiples of this notetag.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module BASEITEM
PASSIVE_STATE =
/<(?:pASSIVE_STATE|passive state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <def self.load_database
load_database_pst
load_notetags_pst
end
#--------------------------------------------------------------------------
# new method: load_notetags_pst
#--------------------------------------------------------------------------
def self.load_notetags_pst
groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
$data_enemies]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_pst
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :passive_states
#--------------------------------------------------------------------------
# common cache: load_notetags_pst
#--------------------------------------------------------------------------
def load_notetags_pst
@passive_states = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::pASSIVE_STATE
$1.scan(/\d+/).each { |num|
@passive_states.push(num.to_i) if num.to_i > 0 }

#---
end
} # self.note.split
#---
end
end # RPG::BaseItem


#==============================================================================
# ■ RPG::EquipItem
#==============================================================================
class RPG::EquipItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :rune_passive
attr_accessor :real_rune_passive
#--------------------------------------------------------------------------
# common cache: load_notetags_pst
#--------------------------------------------------------------------------
def load_notetags_pst
@passive_states = []
@real_rune_passive = []
@rune_passive = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::pASSIVE_STATE
$1.scan(/\d+/).each { |num|
@passive_states.push(num.to_i) if num.to_i > 0
@real_rune_passive.push(num.to_i) if num.to_i > 0
@rune_passive.push(num.to_i) if num.to_i > 0
self.features << Feature.new(70, num.to_i, 0)
}

#---
end
} # self.note.split
#---
end
end # RPG::EquipItem

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state?
#--------------------------------------------------------------------------
alias game_battlerbase_state_check_pst state?
def state?(state_id)
return true if passive_state?(state_id)
return game_battlerbase_state_check_pst(state_id)
end
#--------------------------------------------------------------------------
# alias method: states
#--------------------------------------------------------------------------
alias game_battlerbase_states_pst states
def states
array = game_battlerbase_states_pst
array |= passive_states
return array
end
#--------------------------------------------------------------------------
# new method: passive_state?
#--------------------------------------------------------------------------
def passive_state?(state_id)
@passive_states = [] if @passive_states.nil?
return @passive_states.include?(state_id)
end

#--------------------------------------------------------------------------
# new method: passive_states
#--------------------------------------------------------------------------
def passive_states
array = []
if actor?
for state_id in self.actor.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for equip in equips
next if equip.nil?
for state_id in equip.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end

for state_id_rune in equip.rune_passive
array.push($data_states[state_id_rune]) if passive_state_addable?(state_id_rune)
end

end

#=====================================================
#~ passive_rune_list = @rune_passive #passive_rune_set
#~ for state_id_rune in passive_rune_list
#~ array.push($data_states[state_id_rune]) if passive_state_addable?(state_id_rune)
#~ end
#======================================================

else # enemy
for state_id in self.enemy.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
if $imported["YEA-Doppelganger"] && !self.class.nil?
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
end
end


create_passive_state_array(array)
sort_passive_states(array)
set_passive_state_turns(array)
return array
end
#--------------------------------------------------------------------------
# new method: create_passive_state_array
#--------------------------------------------------------------------------
def create_passive_state_array(array)
@passive_states = []
for state in array
@passive_states.push(state.id)
end
end
#--------------------------------------------------------------------------
# new method: passive_state_addable?
#--------------------------------------------------------------------------
def passive_state_addable?(state_id)
return false if $data_states[state_id].nil?
return alive?
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def sort_passive_states(array)
array.sort! do |state_a, state_b|
if state_a.priority != state_b.priority
state_b.priority <=> state_a.priority
else
state_a.id <=> state_b.id
end
end
return array
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def set_passive_state_turns(array)
for state in array
@state_turns[state.id] = 0 unless @states.include?(state.id)
@state_steps[state.id] = 0 unless @states.include?(state.id)
end
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state_addable?
#--------------------------------------------------------------------------
alias game_battler_state_addable_ps state_addable?
def state_addable?(state_id)
return false if passive_state?(state_id)
return game_battler_state_addable_ps(state_id)
end
#--------------------------------------------------------------------------
# alias method: remove_state
#--------------------------------------------------------------------------
alias game_battler_remove_state_ps remove_state
def remove_state(state_id)
return if passive_state?(state_id)
game_battler_remove_state_ps(state_id)
end
end # Game_Battler
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
;>
Traits Namer (Moogle_X edit)

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#  ▼ Traits Namer

#  Author: Kread-EX

#  Version: 1.02

#  Release date: 11/03/2012

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

 

#------------------------------------------------------------------------------

#  ▼ UPDATES

#------------------------------------------------------------------------------

# # 03/02/2012. Bug fixes.

# # 24/03/2012. Added methods used by Alchemic Synthesis.

# # 23/03/2012. Version 1.0, now help window generation is included.

#------------------------------------------------------------------------------

#  ▼ TERMS OF USAGE

#------------------------------------------------------------------------------

# #  You are free to adapt this work to suit your needs.

# #  You can use this work for commercial purposes if you like it.

# #  Credit is appreciated.

# #

# # For support:

# # grimoirecastle.wordpress.com

# # rpgmakerweb.com

#------------------------------------------------------------------------------

#  ▼ INTRODUCTION

#------------------------------------------------------------------------------

# # This is a core script. By itself, it doesn't do anything but it used by

# # Runic Enchantment and Alchemic Synthesis. The purpose of this script

# # is to provide an automated way to name traits: the script retrieve the traits

# # data and generates a name based on a customizable template.

#------------------------------------------------------------------------------

 

$imported = {} if $imported.nil?

$imported['KRX-TraitsNamer'] = true

 

puts 'Load: Traits Namer v1.02 by Kread-EX'

 

module KRX

  module TraitsNamer

#===========================================================================

# ■ CONFIGURATION

#===========================================================================

 

    X_PARAMETERS = [

    

    'Accuracy',

    'Evasion',

    'Critical rate',

    'Critical eva. rate',

    'M. Evasion',

    'Magic reflection',

    'Counter rate',

    'HP Regen',

    'MP Regen',

    'TP Regen'

    

    ]

    

    S_PARAMETERS = [

    

    'Aggro effect',

    'Guard effect',

    'Recovery rate',

    'Pharmacology',

    'MP cost',

    'TP charge rate',

    'Physical damage',

    'Magical damage',

    'Floor damage',

    'EXP rate'

    

    ]

 

    SPECIAL_FLAGS = [

    

    'Autobattle',

    'Guard',

    'Cover',

    'TP Saver'

    

    ]

    

    PARTY_ABILITY = [

    

    'Half Encounter',

    'No Encounter',

    'No surprise attacks',

    'No preemptive attacks',

    'Gold x2',

    'Item Drops x2'

    

    ]

    

    CODENAMES = {

    

    11 => '%s resist: %d%%'       , # Element rate

    12 => '%s debuff rate: %d%%'  , # Debuff rate

    13 => '%s resist: %d%%'       , # State rate

    14 => 'Immunity: %s'          , # State immunity

    21 => '%s: %d%%'              , # Parameter rate

    22 => '%s: %d%%'              , # Additional parameter rate

    23 => '%s: %d%%'              , # Special parameter rate

    31 => 'Attack %s'             , # Physical attack attribute

    32 => 'Attack %s %d%%'        , # Physical attack state

    33 => 'Attack speed %d'       , # Attack speed correction

    34 => 'Attack x%d'            , # Additional attacks

    41 => 'Command: %s'           , # Add skill type

    42 => 'Seal: %s'              , # Seal skill type

    43 => 'Skill: %s'             , # Add skill

    44 => 'Skill Seal: %s'        , # Seal skill

    51 => 'Can equip: %s'         , # Add equip type (weapon)

    52 => 'Can equip: %s'         , # Add equip type (armor)

    53 => 'Fix equip: %s'         , # Fix equip slot

    54 => 'Seal equip: %s'        , # Seal equip slot

    55 => 'Dual Wielding'         , # Dual Wield

    61 => 'Bonus Actions: +%d%%'  , # Bonus actions

    62 => '%s'                    , # Special flag

    63 => 'Collapse type'         , # Collapse type (will never be used, I think)

    64 => '%s'                    , # Party ability

    66 => 'Convert HP Physical: +%d%%'       , # Convert HP Physical

    67 => 'Convert HP Magical: +%d%%'       , # Convert HP Magical

    68 => 'Convert MP Physical: +%d%%'       , # Convert MP Physical

    69 => 'Convert MP Magical: +%d%%'       , # Convert MP Magical

    70 => 'Passive State: %s'     , # Passive State 

    

    }

    

    CODEHELP = {

    

    # Element rate

    11 => 'Raises %s resistance by %d%%.',

    # Debuff rate

    12 => 'Raises %s resistance by %d%%.',

    # State rate

    13 => 'Raises %s resistance by %d%%.',

    # State immunity

    14 => 'Grants immunity to %s.',

    # Parameter rate

    21 => 'Raises %s by %d%%.',

    # Additional parameter rate

    22 => 'Raises %s by %d%%.',

    # Special parameter rate

    23 => 'Grants a %d% modifier to %s.',

    # Physical attack attribute 

    31 => 'Adds %s element to normal attacks.',

    # Physical attack state

    32 => 'Adds %s to normal attacks (%d%% accuracy).',

    # Attack speed correction (bonus)

    33 => ['Raises attack speed by %d.',

    # Attack speed correction (malus)

    'Reduces attack speed by %d.'],

    # Additional attacks

    34 => 'Grants %d additional attacks.',

    # Add skill type

    41 => 'Enables the %s battle command.',

    # Seal skill type

    42 => 'Seals the %s battle command.',

    # Add skill

    43 => 'Allows the use of the %s skill',

    # Seal skill

    44 => 'Seals the %s skill.',

    # Add equip type (weapon)

    51 => 'Allows %s to be equipped.',

    # Add equip type (armor)

    52 => 'Allows %s to be equipped.',

    # Fix equip slot

    53 => 'Fixes the %s equipment slot.',

    # Seal equip slot

    54 => 'Seals the %s equipment slot.',

    # Dual Wield

    55 => 'Allows to use two weapons as the same time.',

    # Bonus actions

    61 => 'Raises the action rate by %d%%.',

    # Autobattle

    62 => ['The character will act on his/her own in battle.',

    # Guard

    'The character will permanently defend.',

    # Cover

    'The character will take hits for his/her wounded comrades.',

    # TP Saver

    'TP are kept after battles.'],

    # Collapse type (no need to use it but meh)

    63 => 'Alters the collapse animation.',

    # Half encounter

    64 => ['Halves the random encounter rate.',

    # No encounter

    'Disables random encounters.',

    # No surprise attacks

    'Disables surprise attacks.',

    # No preemptive attacks

    'Disables preemptive attacks.',

    # Gold x2

    'Doubles the money obtained after a battle.',

    # Item Drops x2

    'Doubles the drop rate of items.']

    

    }

 

    EFFECTS_CODENAMES = {

    

    11 => 'HP Recovery'                   , # HP Recovery

    12 => 'MP Recovery'                   , # MP Recovery

    13 => 'TP Recovery'                   , # TP Gain

    21 => 'Add %s'                        , # Add State

    22 => 'Cleanse %s'                    , # Remove State

    31 => '%s+'                           , # Add buff

    32 => '%s-'                           , # Add debuff

    33 => 'Dispel %s+'                    , # Remove buff

    34 => 'Cancel %s-'                    , # Remove debuff

    41 => 'Escape'                        , # Escape

    42 => '%s Bonus'                      , # Permanent stat growth

    43 => 'Learn %s'                      , # Permanent skill learning

    44 => 'Common Event'                  , # Common event

    

    }

    

    EFFECTS_CODEHELP = {

    

    # HP Recovery (static)

    11 => ['Restores %d HP.',

    # HP Recovery (dynamic)

    'Restores %d%% of maximum HP.'],

    # MP Recovery (static)

    12 => ['Restores %d MP.',

    # MP Recovery (dynamic)

    'Restores %d%% of maximum MP.'],

    # TP Gain

    13 => 'Restores %d%% TP.',

    # Add State

    21 => 'Inflicts %s (%d%% chance).',

    # Remove State

    22 => 'Cancels %s.',

    # Add buff

    31 => 'Increases %s for %d turns.',

    # Add debuff

    32 => 'Decreases %s for %d turns.',

    # Remove buff

    33 => 'Cancels a previously applied %s buff.',

    # Remove debuff

    34 => 'Dispels an active %s debuff.',

    # Escape

    41 => 'Automatically escape from battle.',

    # Permanent stat growth

    42 => 'Boosts %d by %d permanently.',

    # Permanent skill learning

    43 => 'Teaches the %s skill permanently.',

    # Common Event

    44 => 'Calls a common event.'

    

    }

    

#===========================================================================

# ■ CUSTOM TRAITS/EFFECTS CONFIGURATION

#===========================================================================

 

    # INSTRUCTIONS

    # Here you can define custom traits names and descriptions.

    #

    # Syntax:

    # [type, code, data_id, value 1, value2] => [name, description]

    #

    # type: 0 (for equipment), 1 (for usables)

    #

    # code: the code number. Refer to default naming to know what is what.

    #

    # data_id: the number of the option you've choosen in the trait droplist.

    #

    # value1: what you typed in the first field where you can write numbers.

    # For equipment this is the only one.

    #

    # value2: usable items only. What you typed in the second field.

    #

    # description: If you want to also use a custom description. If you only

    # want the custom name, set this to nil.

 

    CUSTOM_TRAITS = {

    

    [0, 32, 2, 50] => ['Poisonous', nil],

    [0, 32, 2, 100] => ['Venomous', nil],

    

    [1, 11, 0, 0, 10] => ['HP Recovery XS', nil],

    [1, 11, 0, 0, 25] => ['HP Recovery S', nil],

    [1, 11, 0, 0, 50] => ['HP Recovery M', nil],

    [1, 11, 0, 0, 75] => ['HP Recovery L', nil],

    [1, 11, 0, 0, 100] => ['HP Recovery XL', 'Restores all HP!'],

    [1, 12, 0, 0, 10] => ['MP Recovery XS', nil],

    [1, 12, 0, 0, 25] => ['MP Recovery S', nil],

    [1, 12, 0, 0, 50] => ['MP Recovery M', nil],

    [1, 12, 0, 0, 75] => ['MP Recovery L', nil],

    [1, 12, 0, 0, 100] => ['MP Recovery XL', 'Restores all MP!'],

    [1, 13, 0, 2, 0] => ['TP Recovery XS', nil],

    [1, 13, 0, 5, 0] => ['TP Recovery S', nil],

    [1, 13, 0, 10, 0] => ['TP Recovery M', nil],

    [1, 13, 0, 16, 0] => ['TP Recovery L', nil],

    [1, 13, 0, 20, 0] => ['TP Recovery XL', nil],

    

    }

    

#===========================================================================

# ■ CONFIGURATION ENDS HERE

#===========================================================================

    #--------------------------------------------------------------------------

    # ● Generates traits name

    #--------------------------------------------------------------------------

    def self.feature_name(code, data_id, value)

      custom = CUSTOM_TRAITS[[0, code, data_id, self.convert_value(code, value)]]

      return custom[0] unless custom.nil? || custom[0].nil?

      base_name = CODENAMES

Code:
      data_name = case code

        when 11, 31

          $data_system.elements[data_id]

        when 12, 21

          Vocab.param(data_id)

        when 13, 14, 32, 70

          $data_states[data_id].name

        when 22

          X_PARAMETERS[data_id]

        when 23

          S_PARAMETERS[data_id]

        when 41, 42

          $data_system.skill_types[data_id]

        when 43, 44

          $data_skills[data_id].name

        when 51

          $data_system.weapon_types[data_id]

        when 52

          $data_system.armor_types[data_id]

        when 53, 54

          Vocab.etype(data_id)

        when 62

          SPECIAL_FLAGS[data_id]

        when 64

          PARTY_ABILITY[data_id]

        end

      final_value = case code

        when 11, 13

          100 - (value * 100)

        when 33, 66, 67, 68, 69

          value

        when 34

          value + 1

        else

          value * 100

        end

      if data_name.nil?

        name = sprintf(base_name, final_value)

      else

        name = sprintf(base_name, data_name, final_value)

      end

      name

    end

    #--------------------------------------------------------------------------

    # ● Generates traits description

    #--------------------------------------------------------------------------

    def self.feature_description(code, data_id, value)

      custom = CUSTOM_TRAITS[[0, code, data_id, self.convert_value(code, value)]]

      return custom[1] unless custom.nil? || custom[1].nil?

      if CODEHELP
Code:
.is_a?(Array)

        base_help = CODEHELP[code=auto:0][data_id]

      else

        base_help = CODEHELP[code=auto:0]

      end

      data_name = case code

        when 11, 31

          $data_system.elements[data_id]

        when 12, 21

          Vocab.param(data_id)

        when 13, 14, 32

          $data_states[data_id].name

        when 22

          X_PARAMETERS[data_id]

        when 23

          S_PARAMETERS[data_id]

        when 41, 42

          $data_system.skill_types[data_id]

        when 43, 44

          $data_skills[data_id].name

        when 51

          $data_system.weapon_types[data_id]

        when 52

          $data_system.armor_types[data_id]

        when 53, 54

          Vocab.etype(data_id)

        when 62

          SPECIAL_FLAGS[data_id]

        when 64

          PARTY_ABILITY[data_id]

        end

      final_value = case code

        when 11, 13

          100 - (value * 100)

        when 33, 34

          value

        else

          value * 100

        end

      if data_name.nil?

        name = sprintf(base_help, final_value)

      else

        name = sprintf(base_help, data_name, final_value)

      end

      name

    end

    #--------------------------------------------------------------------------

    # ● Generates effects name

    #--------------------------------------------------------------------------

    def self.effect_name(code, data_id, value1, value2)

      custom = CUSTOM_TRAITS[[1, code, data_id,

      self.convert_value(code, value1, false),

      self.convert_value(code, value2, false)]]

      return custom[0] unless custom.nil? || custom[0].nil?

      base_name = EFFECTS_CODENAMES[code=auto:0]

      data_name = case code

        when 21, 22

          $data_states[data_id].name

        when 31, 32, 33, 34, 42

          Vocab.param(data_id)

        when 43

          $data_skills[data_id]

        end

      if data_name.nil?

        name = sprintf(base_name, value1, value2)

      else

        name = sprintf(base_name, data_name, value1, value2)

      end

      name

    end

    #--------------------------------------------------------------------------

    # ● Generates effects description

    #--------------------------------------------------------------------------

    def self.effect_description(code, data_id, value1, value2)

      custom = CUSTOM_TRAITS[[1, code, data_id,

      self.convert_value(code, value1, false),

      self.convert_value(code, value2, false)]]

      return custom[1] unless custom.nil? || custom[1].nil?

      if EFFECTS_CODEHELP[code=auto:0].is_a?(Array)

        base_help = value2 > 0 ? EFFECTS_CODEHELP[code=auto:0][0] :

        EFFECTS_CODEHELP[code=auto:0][1]

      else

        base_help = EFFECTS_CODEHELP[code=auto:0]

      end

      data_name = case code

        when 21, 22

          $data_states[data_id].name

        when 31, 32, 33, 34, 42

          Vocab.param(data_id)

        when 43

          $data_skills[data_id]

        end

      value1 = self.convert_value(code, value1, false)

      value2 = self.convert_value(code, value2, false)

      value1 = value2 if value1 == 0

      if data_name.nil?

        name = sprintf(base_help, value1, value2)

      else

        name = sprintf(base_help, data_name, value1, value2)

      end

      name

    end

    #--------------------------------------------------------------------------

    # ● Converts the real value to the one entered in the editor

    #--------------------------------------------------------------------------

    def self.convert_value(code, value, feature = true)

      if feature && [33, 34].include?(code)

        return value.to_i

      elsif feature && [21].include?(code)

        return (value.to_f / 100)

      elsif [11, 12].include?(code) && value <= 1

        return (value.to_i * 100).to_i

      else

        value.to_i

      end

    end

    #--------------------------------------------------------------------------

    # ● Points towards either feature name or effect name

    #--------------------------------------------------------------------------

    def self.trait_name(trait)

      if trait.is_a?(RPG::BaseItem::Feature)

        return self.feature_name(trait.code, trait.data_id, trait.value)

      end

      self.effect_name(trait.code, trait.data_id, trait.value1, trait.value2)

    end

    #--------------------------------------------------------------------------

    # ● Points towards either feature description or effect description

    #--------------------------------------------------------------------------

    def self.trait_description(trait)

      if trait.is_a?(RPG::BaseItem::Feature)

        return self.feature_description(trait.code, trait.data_id, trait.value)

      end

      self.effect_description(trait.code, trait.data_id, trait.value1,

      trait.value2)

    end

  end

end



 

Runic Enchantment / Passive States Compatability Patch by Moogle_X)

 

[/SPOILER]

 

# Runic Enchantment - Yanfly's Passive States Compatibility Patch

# by Moogle_X

# Put this below both Runic Enchantment and Passive States scripts.

 

#===========================================================================

# ■ Game_Party

#===========================================================================

 

class Game_Party < Game_Unit

 

#--------------------------------------------------------------------------

# alias method: inscribes_rune

#--------------------------------------------------------------------------

  alias moogle_x_passive_rune_alias inscribe_rune

  def inscribe_rune(e_type, e_id, r_id, r_index)

    moogle_x_passive_rune_alias(e_type, e_id, r_id, r_index)

    refresh_rune_passive

  end

 

#--------------------------------------------------------------------------

# new method: refresh_rune_passive

#--------------------------------------------------------------------------

  def refresh_rune_passive

    @enchants_w ||= {}

    @enchants_w.each do | w_id,r_list |

      $data_weapons[w_id].rune_passive = $data_weapons[w_id].real_rune_passive

      for r_id in r_list

        $data_weapons[w_id].rune_passive += $data_armors[r_id].rune_passive if r_id != nil

        $data_weapons[w_id].rune_passive.compact.uniq

      end

    end # do

    

    @enchants_a ||= {}

    @enchants_a.each do | a_id,r_list |

      $data_armors[a_id].rune_passive = $data_armors[a_id].real_rune_passive

      for r_id in r_list

        $data_armors[a_id].rune_passive += $data_armors[r_id].rune_passive if r_id != nil

        $data_armors[a_id].rune_passive.compact.uniq

      end

    end # do

    

  end # refresh_rune_passive

    

end # class Game_Party



 

 

Can anyone assist me in making these load correctly when the game is saved, closed and reloaded from the save file? 

 

I really hope it's possible as I've developed into this idea now and it would be a real shame to lose this functionality.

 

 

Thanks a lot.
 
Last edited by a moderator:

LeeOccleshaw

Stone Dragon Workshop
Veteran
Joined
Jun 9, 2015
Messages
155
Reaction score
82
First Language
English
Primarily Uses
Moogle_X swooped down from the heavens and brought me a fix (to my inbox) - we can close it now. Solved!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,112
Reaction score
11,460
First Language
English
Primarily Uses
RMVXA
If you want your thread closed, please Report your opening post (the Report button is bottom right, near the MultiQuote button) and ask for it to be closed.  The mod for the forum might miss your post but will see your Report.

Thanks.
 

Moogle_X

Veteran
Veteran
Joined
Apr 25, 2015
Messages
157
Reaction score
316
First Language
English
To anyone else having this problem, this is the updated patch.

# Runic Enchantment - Yanfly's Passive States Compatibility Patch ver 2.0
# by Moogle_X
# Put this below both Runic Enchantment and Passive States scripts.
# (Update: Fixed bug issue with loading save file.)
 
#===========================================================================
# ■ Game_Party
#===========================================================================
 
class Game_Party < Game_Unit
 
#--------------------------------------------------------------------------
# alias method: inscribes_rune
#--------------------------------------------------------------------------
  alias moogle_x_passive_rune_alias inscribe_rune
  def inscribe_rune(e_type, e_id, r_id, r_index)
    moogle_x_passive_rune_alias(e_type, e_id, r_id, r_index)
    refresh_rune_passive
  end
 
#--------------------------------------------------------------------------
# new method: refresh_rune_passive
#--------------------------------------------------------------------------
  def refresh_rune_passive
    @enchants_w ||= {}
    @enchants_w.each do | w_id,r_list |
      $data_weapons[w_id].rune_passive = $data_weapons[w_id].real_rune_passive
      for r_id in r_list
        $data_weapons[w_id].rune_passive += $data_armors[r_id].rune_passive if r_id != nil
        $data_weapons[w_id].rune_passive.compact.uniq
      end
    end # do
    
    @enchants_a ||= {}
    @enchants_a.each do | a_id,r_list |
      $data_armors[a_id].rune_passive = $data_armors[a_id].real_rune_passive
      for r_id in r_list
        $data_armors[a_id].rune_passive += $data_armors[r_id].rune_passive if r_id != nil
        $data_armors[a_id].rune_passive.compact.uniq
      end
    end # do
    
  end # refresh_rune_passive
    
end # class Game_Party

#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
#  This module manages the database and game objects. Almost all of the
# global variables used by the game are initialized by this module.
#==============================================================================

module DataManager
 
  class << self
    alias :moogle_x_rune_extract_save_contents :extract_save_contents
  end
 
  def self.extract_save_contents(contents)
    moogle_x_rune_extract_save_contents(contents)
    $game_party.refresh_rune_passive # Loading save file fix.
  end
 
end # module DataManager
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,390
Reaction score
7,219
First Language
German
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Should be able to release Haxe MV/MZ next weekend.
It look that somehow MZ tracks are messed up (for example battle4 is obviously a theme, castle2 is a ship, ship1 is a scene and so on..). Maybe they just named them after with some ambiguity.
is there a script call that return how much turn has passed in battle?
Does anyone find this hard to read?

Enjoying my weekend at home to stay Covid free. How is everyone else doing?

Forum statistics

Threads
100,603
Messages
977,750
Members
132,217
Latest member
Darkscythe25
Top