Showing a window with the current actor parameters (atk, def, mtk and mdf)

So I tried so hard to achiev this myself. I found this post (btw roninator I love you) which was really useful to reach this point:

1659399317123.png


But I can't manage to make it to appear text on it. I tried the "draw_text" but nothing show up anywhere in the screen.
Also, it would be possible, I would like the window to show only during that current actor turn, because this window is showing up all the time during the battle.
You might want to share the code you've written so far so people can help you with it.
You might want to share the code you've written so far so people can help you with it.
I didn't wrote so much actually. I took roni snipet:

Ruby:
class Window_Status_Blank < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, Graphics.height - fitting_height(4), Graphics.width, fitting_height(4))
    self.z = 20
    self.openness = 255
  end
end
class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
end

and modified a little the first lines to make the bar appear over the commands window:
Ruby:
class Window_Status_Blank < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, Graphics.height - fitting_height(6), Graphics.width, fitting_height(1))
    self.z = 20
    self.openness = 255
  end
end
class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
end

I didn't include the "draw_text" because it wasn't returning any text, so I see it useless to include it, but I wrote it after the "self.openness = 255" if that matter.
I didn't wrote so much actually. I took roni snipet:
What do you want to have written in the box?
The code you're trying to modify was intended to be visible always when in battle.
First of all, you need to pass either the actor as a parameter or pass the actor's index (aka position - 1) and then look for the actual actor in the $game_party.members array. Only then you can get his or her attributes and use draw_text to print them on screen.
What do you want to have written in the box?
The code you're trying to modify was intended to be visible always when in battle.
I want it to show the atk, def, mag, and mdf of the current actor's turn, as my game has so many things that modify those params during the battle and the optimal way to play my game is to always be aware of those current params.
First of all, you need to pass either the actor as a parameter or pass the actor's index (aka position - 1) and then look for the actual actor in the $game_party.members array. Only then you can get his or her attributes and use draw_text to print them on screen.
Yeah, I suppose that I had to do something like that. The problem is that I'm not even able to draw a simple text as "hello" nor anything xd

EDIT: Sorry admins/moderator, I was so asleep that didn't notice I made a double comment.
show the atk, def, mag, and mdf of the current actor's turn
Ruby:
class Window_Status_Blank < Window_Base
  def initialize
    super(0, Graphics.height - fitting_height(6), Graphics.width, fitting_height(1))
    self.z = 20
    hide
    @actor = nil
  end
  def setup(actor)
    @actor = actor
    create_contents
    show_data
    show
  end
  def show_data
    draw_actor_name(@actor, 0, 0, 100)
    text = "ATK #{@actor.atk} : DEF #{@actor.def} : MAT #{@actor.mat} : MDF #{@actor.mdf}"
    draw_text(100, 0, Graphics.width - 100, line_height, text)
  end
end
class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
  alias r2_actor_command_show_status  start_actor_command_selection
  def start_actor_command_selection
    r2_actor_command_show_status
    @status_back_window.setup(BattleManager.actor)
  end
  alias r2_turn_start_display_actor_status_data turn_start
  def turn_start
    @status_back_window.close
    r2_turn_start_display_actor_status_data
  end
end
Ruby:
class Window_Status_Blank < Window_Base
  def initialize
    super(0, Graphics.height - fitting_height(6), Graphics.width, fitting_height(1))
    self.z = 20
    hide
    @actor = nil
  end
  def setup(actor)
    @actor = actor
    create_contents
    show_data
    show
  end
  def show_data
    draw_actor_name(@actor, 0, 0, 100)
    text = "ATK #{@actor.atk} : DEF #{@actor.def} : MAT #{@actor.mat} : MDF #{@actor.mdf}"
    draw_text(100, 0, Graphics.width - 100, line_height, text)
  end
end
class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
  alias r2_actor_command_show_status  start_actor_command_selection
  def start_actor_command_selection
    r2_actor_command_show_status
    @status_back_window.setup(BattleManager.actor)
  end
  alias r2_turn_start_display_actor_status_data turn_start
  def turn_start
    @status_back_window.close
    r2_turn_start_display_actor_status_data
  end
end

My brother in christ! I wasn't expecting to give me the whole script but just explain how to do it. You are a real chad!

1659447131019.png
I suspect the text is a bit wider than it should be because its width calculation is ignoring the horizontal padding.
its width calculation is ignoring the horizontal padding.
Yes, but this is not affected in the little data presented.
1659467774129.png
Yes, but this is not affected in the little data presented.
Roni, I love you so much right now!
But I have a couple problems.
First one is that during the next turn the windows dissapear.
1659526697143.png

1659526770012.png


Second one is that after some skill/state modify those parameters, the change is not showing up in the box, but I'm certainly sure it has changed. (I tested by attacking with and without a buff).

About the first one, I'm not sure cuz at this point is very obvius I'm not a coder... but could be something to do with the "turn_start" only counts the first turn of the battle or something? or maybe cuz there's not a method to return the screen after it goes away?

about the second, looking at another scripts, the use some "refresh" command. Could it be lacking that to show the real-time param?

Anyways, this script is awesome so far! Thank you very much.
First one is that during the next turn the windows dissapear.
Didn't see that before, interesting. Just add in an open before the show on line 12.
1659550329961.png


What process did you use to have the data form in that layout?

Second one is that after some skill/state modify those parameters, the change is not showing up in the box
I did a test and it showed the change for me.

Here is a more robust script. (taking into account the way you displayed the stats)
1659553860311.png

Spoiler: Display stats on actor command
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Stat display on Actor Command║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Display actor stats in window     ╠════════════════════╣
# ║   During actor command selection    ║    03 Aug 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Change Params below for the stats you want to display  ║
# ║    0 = HP   ;   1 = MP                                   ║
# ║    2 = ATK  ;   3 = DEF                                  ║
# ║    4 = MAT  ;   5 = MDF                                  ║
# ║    6 = AGI  ;   7 = LUK                                  ║
# ║   Change window position and width                       ║
# ║   Change Actor Name colour                               ║
# ║   Change Stat Colours                                    ║
# ║   Stat colours must correcpond to the stats in the array ║
# ║      e.g. Param = [2,3]                                  ║
# ║           Stat_Colours = [15,29]                         ║
# ║  param 2 will be in colour 15, param 3 will be colour 29 ║
# ║    All Colours come from the windowskin graphic          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - Initial publish                                   ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker                           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_List_Param_display
  Params = [2,3,4,5]
  Window_X = 0
  Window_Y = 100
  Window_Width = 100
  Set_Actor_Name_Colour = true
  Actor_Colour = 21
  Set_Stat_Colour = false
  Stat_Colours = [3,8,18,31]
end

class Window_Status_Blank < Window_Base
  def initialize
    x = R2_List_Param_display::Window_X
    y = R2_List_Param_display::Window_Y
    w = R2_List_Param_display::Window_Width + standard_padding
    h = (R2_List_Param_display::Params.size + 1) * line_height + standard_padding * 2
    super(x, y, w, h)
    self.z = 20
    hide
    @actor = nil
    @param_data = ["HP", "MP", "ATK", "DEF", "MAT", "MDF", "AGI", "LUK"]
  end
  def setup(actor)
    @actor = actor
    create_contents
    show_data
    open
    show
  end
  def show_data
    y = 0
    x = 0
    w = R2_List_Param_display::Window_Width - standard_padding
    height = line_height
    if R2_List_Param_display::Set_Actor_Name_Colour == true
      change_color(text_color(R2_List_Param_display::Actor_Colour))
      draw_text(x, y, w, height, @actor.name, 0)
      change_color(normal_color)
    else
      draw_actor_name(@actor, x, y, w)
    end
    y += line_height# + standard_padding
    R2_List_Param_display::Params.each_with_index do |pp, i|
      stat = "#{@param_data[pp]}:"
      value = "#{@actor.param(pp)}"
      if R2_List_Param_display::Set_Stat_Colour == true
        change_color(text_color(R2_List_Param_display::Stat_Colours[i]))
      end
      draw_text(x, y, w, height, stat, 0)
      change_color(normal_color)
      draw_text(x, y, w, height, value, 2)
      y += line_height
    end
    change_color(normal_color)
  end
end

class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
  alias r2_actor_command_show_status  start_actor_command_selection
  def start_actor_command_selection
    r2_actor_command_show_status
    @status_back_window.setup(BattleManager.actor)
  end
  alias r2_turn_start_display_actor_status_data turn_start
  def turn_start
    @status_back_window.close
    r2_turn_start_display_actor_status_data
  end
end
I did a test and it showed the change for me.
Nevermind, I'm stupid. I was using an snipet for enemies to change their params, and for some reason I tried to use the same snipet for actors but it's not working.

Spoiler: Snipet
Ruby:
  class Game_Enemy < Game_Battler
  def change_param(param_id, value)
    enemy.params[param_id] = value
  end
end

  class Game_Actor < Game_Battler
  def change_param(param_id, value)
    self.class.params[param_id] = value
  end
end

What process did you use to have the data form in that layout?
Spoiler: code modified
Ruby:
class Window_Status_Blank < Window_Base
  def initialize
    super(10, fitting_height(0), 140, 110)
    self.z = 20
    hide
    @actor = nil
  end
  def setup(actor)
    @actor = actor
    create_contents
    show_data
    show
  end
  def show_data
    draw_actor_name(@actor, 0, 0, 100)
    text  = "ATK: #{@actor.atk}"
    text2 = "DEF: #{@actor.def}"
    text3 = "MAT: #{@actor.mat}"
    draw_text(0, 20, Graphics.width - 20, line_height, text)
    draw_text(0, 40, Graphics.width - 20, line_height, text2)
    draw_text(0, 60, Graphics.width - 20, line_height, text3)
  end
end
class Scene_Battle < Scene_Base
  alias r2_create_status_back_all_windows create_all_windows
  def create_all_windows
    r2_create_status_back_all_windows
    create_status_back_window
  end
  def create_status_back_window
    @status_back_window = Window_Status_Blank.new
  end
  alias r2_actor_command_show_status  start_actor_command_selection
  def start_actor_command_selection
    r2_actor_command_show_status
    @status_back_window.setup(BattleManager.actor)
  end
  alias r2_turn_start_display_actor_status_data turn_start
  def turn_start
    @status_back_window.close
    r2_turn_start_display_actor_status_data
  end
end

I'm sure I did a mess, and at the end I decided to not use de mdf for now.
But wow, you really did a whole new code! It looks awesome! You're a god at this.
You're a god at this.
Honestly, this is simple in comparison to most scripts. It's the level of understanding I have right now.
I'm really struggling to learn more as there are coding concepts that I seem to not grasp or know of.
Honestly, this is simple in comparison to most scripts. It's the level of understanding I have right now.
I'm really struggling to learn more as there are coding concepts that I seem to not grasp or know of.
You don't have an idea how much you have helped me so much. Look at this! Thanks to your help so far I could achiev something that I though it was impossible:

1659559055904.png

1659559095803.png

1659559120010.png

I created a skill(card) that swap the ATK and DEF of everyone and works PERFECTLY. And thanks to your script the player will be able to see that change!
My brother in christ! I wasn't expecting to give me the whole script but just explain how to do it. You are a real chad!

View attachment 236448
AHHAHAHAHAHAHAHAAA LMAO! i felt to my bone this picture!!!
Roninator2 you are our savior so many times...

Original thread: https://forums.rpgmakerweb.com/threads/showing-a-window-with-the-current-actor-parameters-atk-def-mtk-and-mdf.150014/