[VXA] Compatibility between Elemental Modifiers and YEA Status Menu

redcachalot

Veteran
Veteran
Joined
Sep 30, 2015
Messages
37
Reaction score
7
First Language
English
Primarily Uses
RMVXA
I don't know about you guys, but I need to use the YEA Status Menu for the Actors in my project.

YEA Status Menu


It provides all the information that one needs about an Actor, except for the Element Rates.

A cool script that does provide the Element Rates in the default Status Menu is the Elemental Modifiers script by Tsukihime.



Elemental Modifiers

Since this script is no longer supported, I will provide it here:

Ruby:
=begin
==============================================================================
** Elemental Status Info
Author: Hime
Version: 1.0
Date: May 11, 2012
------------------------------------------------------------------------------
** Change log
1.0 May 11, 2012
   - initial release
------------------------------------------------------------------------------
This script displays elemental modifiers information
in your status screen in the menu.

Press OK to show it, press Cancel to close it.
==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Elemental_Status_Window"] = true

module Status_Element

  # List of elements that should not be included in the list
  Ignore = ["Absorb", "Physical"]

  # Element entries. Format: "element name" => [index, icon]
  # The name and icon must match the ones in the database
  Elements = { "Fire"    => [3, 96],
               "Ice"     => [4, 97],
               "Thunder" => [5, 98],
               "Water"   => [6, 99],
               "Earth"   => [7, 100],
               "Wind"    => [8, 101],
               "Holy"    => [9, 102],
               "Dark"    => [10, 103]
             }
           
  # Icons to draw for attack/resistance
  Attack_Icon = 385
  Resist_Icon = 510
end
               
class Game_Battler < Game_BattlerBase              

  def element_resist
   
  end

  def element_attack
  end
end

class Game_Actor < Game_Battler

  def equips_elements(element_id)
  end

  def element_resist
   
  end
end

#===============================================================================
# * Windows and scenes
#===============================================================================

class Window_ElementStatus < Window_Selectable

  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.opacity = 0
    self.contents_opacity = 0
    setup_anim if $imported["Animated_Windows"]
  end

  def setup_anim
    @fade_speed = 5
    @hide_x = self.x + self.width
    self.x = @hide_x
    self.opacity = 0
  end

  def actor=(actor)
    return if @actor == actor
    @actor = actor
    refresh
  end

  def ignore_list
    Status_Element::Ignore
  end

  def include?(item)
    return true unless item.nil? || item.empty? || ignore_list.include?(item)
  end

  def item_max
    @data ? @data.size : 1
  end

  def make_item_list
    @data = $data_system.elements.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end

  def element_info(item)
    Status_Element::Elements[item]
  end

  def attack_icon
    Status_Element::Attack_Icon
  end
   
  def resist_icon
    Status_Element::Resist_Icon
  end

  def element_resist(element_id)
    if $imported["Elemental_Modifiers"]
      element_rate = @actor.element_resist_rate(element_id)
    else
      element_rate = @actor.element_rate(element_id)
    end
    resist = "%d%" %[0 + (element_rate*100 - 100) * -1.to_i]
    return resist
  end

  def element_damage(element_id)
    if $imported["Elemental_Modifiers"]
      element_rate = @actor.element_attack_rate(element_id)
    else
      element_rate = @actor.element_rate(element_id)
    end
    resist = "%d%" %[0 + (element_rate*100 - 100).to_i]
    return resist
  end

  def draw_item(index)
    item = @data[index]
    if item
      info = element_info(item)
      icon_index = info[1]
      rect = item_rect(index)
      rect.width -= 4
      draw_icon(icon_index, rect.x, rect.y) if icon_index
      draw_text(rect.x + 32, rect.y, 172, line_height, item)
      draw_icon(attack_icon, rect.x + 148, rect.y)
      draw_text(rect.x + 180, rect.y, 172, line_height, element_damage(info[0]))
      draw_icon(resist_icon, rect.x + 252, rect.y)
      draw_text(rect.x + 284, rect.y, 172, line_height, element_resist(info[0]))
    end
  end

  def refresh
    make_item_list
    contents.clear
    draw_all_items
  end

  def slide_speed
    10
  end

  def show
    if $imported["Animated_Windows"]
      @new_x = @show_x
      @new_opacity = 255
    else
      self.opacity = 255
      self.contents_opacity = 255
      self.back_opacity = 255
    end
  end

  def hide
    if $imported["Animated_Windows"]
      @new_x = @hide_x
      @new_opacity = 0
    else
      self.opacity = 0
      self.contents_opacity = 0
      self.back_opacity = 0
    end
  end
end

class Scene_Status < Scene_MenuBase

  alias tsuki_element_status_start start
  def start
    tsuki_element_status_start
    @status_window.set_handler(:ok,  method(:on_status_ok))
    create_element_window
  end

  def create_element_window
    wx = Graphics.width - 400
    wy = 200
    @element_window = Window_ElementStatus.new(wx, wy, 400, Graphics.height - wy)
    @element_window.set_handler(:cancel,  method(:on_element_cancel))
    @element_window.actor = @actor
  end

  def on_status_ok
    @element_window.show
    @element_window.activate  
  end

  def on_element_cancel
    @element_window.hide
    @status_window.activate
  end
end


It would be great to use both of these scripts together in the same project, but doing so makes one run into an error: a NoMethodError occurs for undefined method 'set_handler'.

Yet separately, both scripts work just fine. The error only arises when they are used together.
Can the Element Modifiers script be made compatible with YEA Status Menu?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,649
Reaction score
562
First Language
English
Primarily Uses
RMVXA
This should work for you. replace the bottom of Element modifier script or comment it out and add this after the other two. If you just add it, you will get a stack level too deep message.
Ruby:
class Scene_Status < Scene_MenuBase

  alias tsuki_element_status_start start
  def start
    tsuki_element_status_start
    create_element_window
  end

  def create_element_window
    wx = Graphics.width - 400
    wy = 200
    @element_window = Window_ElementStatus.new(wx, wy, 400, Graphics.height - wy)
    @element_window.set_handler(:cancel,  method(:on_element_cancel))
    @element_window.actor = @actor
    @element_window.z = 300
  end

  def on_status_ok
    @element_window.show
    @element_window.activate 
    @command_window.deactivate
  end

  def on_element_cancel
    @element_window.hide
    @command_window.activate
  end
 
  alias r2_scene_status_update_917b update
  def update
    r2_scene_status_update_917b
    if Input.trigger?(:C)
      on_status_ok
    end
  end
end
 

redcachalot

Veteran
Veteran
Joined
Sep 30, 2015
Messages
37
Reaction score
7
First Language
English
Primarily Uses
RMVXA
This should work for you. replace the bottom of Element modifier script or comment it out and add this after the other two. If you just add it, you will get a stack level too deep message.
I replaced all of
class Scene_Status < Scene_MenuBase with all of the new code, as suggested.
It unfortunately gives a new error message: line 142 NoMethodError undefined method '[]' for nil:NilClass.

In Elemental Modifiers, this error is pointing to
def draw_item(index) => icon_index = info[1]

Do I have to make some icon configurations?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,649
Reaction score
562
First Language
English
Primarily Uses
RMVXA
That should be completely unrelated to what I did.
You must have done something wrong.
I modified the script to make it inclusive to either method/script
replace element info script with this.
Ruby:
=begin
==============================================================================
** Elemental Status Info
Author: Hime
Version: 1.0
Date: May 11, 2012
------------------------------------------------------------------------------
** Change log
1.0 May 11, 2012
   - initial release
------------------------------------------------------------------------------
This script displays elemental modifiers information
in your status screen in the menu.

Press OK to show it, press Cancel to close it.
==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Elemental_Status_Window"] = true

module Status_Element

  # List of elements that should not be included in the list
  Ignore = ["Absorb", "Physical"]

  # Element entries. Format: "element name" => [index, icon]
  # The name and icon must match the ones in the database
  Elements = { "Fire"    => [3, 96],
               "Ice"     => [4, 97],
               "Thunder" => [5, 98],
               "Water"   => [6, 99],
               "Earth"   => [7, 100],
               "Wind"    => [8, 101],
               "Holy"    => [9, 102],
               "Dark"    => [10, 103]
             }
          
  # Icons to draw for attack/resistance
  Attack_Icon = 385
  Resist_Icon = 510
end
              
class Game_Battler < Game_BattlerBase             

  def element_resist
  
  end

  def element_attack
  end
end

class Game_Actor < Game_Battler

  def equips_elements(element_id)
  end

  def element_resist
  
  end
end

#===============================================================================
# * Windows and scenes
#===============================================================================

class Window_ElementStatus < Window_Selectable

  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.opacity = 0
    self.contents_opacity = 0
    setup_anim if $imported["Animated_Windows"]
  end

  def setup_anim
    @fade_speed = 5
    @hide_x = self.x + self.width
    self.x = @hide_x
    self.opacity = 0
  end

  def actor=(actor)
    return if @actor == actor
    @actor = actor
    refresh
  end

  def ignore_list
    Status_Element::Ignore
  end

  def include?(item)
    return true unless item.nil? || item.empty? || ignore_list.include?(item)
  end

  def item_max
    @data ? @data.size : 1
  end

  def make_item_list
    @data = $data_system.elements.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end

  def element_info(item)
    Status_Element::Elements[item]
  end

  def attack_icon
    Status_Element::Attack_Icon
  end
  
  def resist_icon
    Status_Element::Resist_Icon
  end

  def element_resist(element_id)
    if $imported["Elemental_Modifiers"]
      element_rate = @actor.element_resist_rate(element_id)
    else
      element_rate = @actor.element_rate(element_id)
    end
    resist = "%d%" %[0 + (element_rate*100 - 100) * -1.to_i]
    return resist
  end

  def element_damage(element_id)
    if $imported["Elemental_Modifiers"]
      element_rate = @actor.element_attack_rate(element_id)
    else
      element_rate = @actor.element_rate(element_id)
    end
    resist = "%d%" %[0 + (element_rate*100 - 100).to_i]
    return resist
  end

  def draw_item(index)
    item = @data[index]
    if item
      info = element_info(item)
      icon_index = info[1]
      rect = item_rect(index)
      rect.width -= 4
      draw_icon(icon_index, rect.x, rect.y) if icon_index
      draw_text(rect.x + 32, rect.y, 172, line_height, item)
      draw_icon(attack_icon, rect.x + 148, rect.y)
      draw_text(rect.x + 180, rect.y, 172, line_height, element_damage(info[0]))
      draw_icon(resist_icon, rect.x + 252, rect.y)
      draw_text(rect.x + 284, rect.y, 172, line_height, element_resist(info[0]))
    end
  end

  def refresh
    make_item_list
    contents.clear
    draw_all_items
  end

  def slide_speed
    10
  end

  def show
    if $imported["Animated_Windows"]
      @new_x = @show_x
      @new_opacity = 255
    else
      self.opacity = 255
      self.contents_opacity = 255
      self.back_opacity = 255
    end
  end

  def hide
    if $imported["Animated_Windows"]
      @new_x = @hide_x
      @new_opacity = 0
    else
      self.opacity = 0
      self.contents_opacity = 0
      self.back_opacity = 0
    end
  end
end

if $imported["YEA-StatusMenu"] == true
class Scene_Status < Scene_MenuBase

  alias tsuki_element_status_start start
  def start
    tsuki_element_status_start
    create_element_window
  end

  def create_element_window
    wx = Graphics.width - 400
    wy = 200
    @element_window = Window_ElementStatus.new(wx, wy, 400, Graphics.height - wy)
    @element_window.set_handler(:cancel,  method(:on_element_cancel))
    @element_window.actor = @actor
    @element_window.z = 300
  end

  def on_status_ok
    @element_window.show
    @element_window.activate 
    @command_window.deactivate
  end

  def on_element_cancel
    @element_window.hide
    @command_window.activate
  end
 
  alias r2_scene_status_update_917b update
  def update
    r2_scene_status_update_917b
    if Input.trigger?(:C)
      on_status_ok
    end
  end
end
else
class Scene_Status < Scene_MenuBase

  alias tsuki_element_status_start start
  def start
    tsuki_element_status_start
    @status_window.set_handler(:ok,  method(:on_status_ok))
    create_element_window
  end

  def create_element_window
    wx = Graphics.width - 400
    wy = 200
    @element_window = Window_ElementStatus.new(wx, wy, 400, Graphics.height - wy)
    @element_window.set_handler(:cancel,  method(:on_element_cancel))
    @element_window.actor = @actor
  end

  def on_status_ok
    @element_window.show
    @element_window.activate 
  end

  def on_element_cancel
    @element_window.hide
    @status_window.activate
  end
end
end
 

redcachalot

Veteran
Veteran
Joined
Sep 30, 2015
Messages
37
Reaction score
7
First Language
English
Primarily Uses
RMVXA
Yes! It reaches the YEA Status Menu without any errors at last!
Though, I don't know why the Elemental modifiers is not appearing in the YEA Status Menu no matter which key I press.
Window_ElementStatus used to appear whenever I would press the Enter button on the keyboard.

I realized that one needs to actually insert the Elemental Modifiers script into the Status Command Window of YEA Status Menu as a custom category in order for this to work properly...
i.e. make Window_ElementStatus appear inside of the Window_StatusItem of YEA Status Menu.
However, in the YEA Status Menu script, draw_custom2 seems to be occupied by YEA-AceEquipEngine and draw_custom3 seems to be reserved for the YEA-ClassSystem.

There don't seem to be any empty custom categories for me to insert the Elemental Modifiers script into.

I'm lost. Please Help!
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,649
Reaction score
562
First Language
English
Primarily Uses
RMVXA
no matter which key I press.
Do you have a keyboard mapping script that changes the key presses?
the default is 'Z' or 'space' or 'enter' which in the script is Input.trigger?( :C)
and that's what the script is checking.

a custom category
That would be another method, but I did not try to make it this way.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just finished composing a boss battle theme!
Scripted a multi-variable weather system that randomizes wind speed, cloudiness, rain, fogginess, etc, while attempting to realistically account for interactions between them (e.g. wind speed affects fogginess, cloudiness affects rain, etc), the current weather pattern, and the player's biome e.g. swamp, beach, etc. Now I "just" have to tie visuals and sounds to the variables so stuff actually happens...
I'm having a headache balancing the combat using flat defense so I'm gonna use percentual armor, in this pic, Simon has 16 on Defense which means all the incoming damage will be reduced by 16% this will ease my burden a bit.
!Have a nice day everybody¡
SO glad they patched outer worlds for switch! I can finally play it! Weird that other peeps are still having issues. I know it was really chugging on my lite when it first came out.

Forum statistics

Threads
105,555
Messages
1,014,624
Members
137,231
Latest member
anjing_gila
Top