Showing Ex-Param changes on the Equip Screen

Hello Forum.

EDIT: HERE IS A QUICK JUMP LINK TO THE COMPLETED SCRIPT,  AS SO KINDLY CREATED BY MITHRAN! For anyone who wants to use it too!

Post 24 in this thread.

--------------------------------------------------------------------

In my current project, I am using the Ex-Params heavily to make different weapons and armor seem more 'unique' than just having the Def and Atk values.

However, when you add such Ex-params like Hit, Evade and the like to an equip-able, the player has no idea these are being changed when they equip or unequip it. I am using Yanfly Engine Ace - Ace Status Menu v1.02 which DOES show these stats when you go to the stats screen. But I would love to show them on the Equip screen so they can tell whats changing on the fly.

What I have so far (and example)

scriptrequest_zps770049e6.jpg


As you can see from this screenshot, I have figured out how to re-size the EquipStatus window, and the EquipItem window myself using the script editor to make room for the new stats.

However, The default script that is currently there to generate the stats does an auto-gen for each line using param_id to create them. I can't figure out how to make it generate the ex-params as well. Will I have to remove the auto-generating default params and put them in manually one by one and then add the xparams after with the same one by one method?

And yes, I would like to use the "temp_player" function that the other stats use to show the changes that will be happening.   (Hit 80% -> 85%)

I perused the forum and the master script list in search of something like this, but strangely all I could find were complete remakes/remodels of the equip screen (none of which added these stats) or people asking to remove some stats... not add some.

Any help, scripts or suggestions are appreciated.

Thanks ahead of time.

Blue001
you just do it like the params... but instead of param(id) you do it I think like xparam(id)
As you can see from this screenshot, I have figured out how to re-size the EquipStatus window, and the EquipItem window myself using the script editor to make room for the new stats.
How did you manage to do that?  I too would love to have ex-params show up for equipment.

I can see how to extend the left window down to allow for more lines, but I'm not sure where to find the specific width for what is now the lower right section to make it narrower so that it doesn't overlap the now extended left window.
go find the param draw lines (all of those)... then adjust and make it use xparams instead of param...


What you'd need:


Replicate the 6.times blahblah (within that same refresh method) and adjust to the number of xparams


replicate and adjust draw_item, draw_param_name, draw_current_param, draw_right_arrow, draw_new_param and adjust to use xparams too


or you can just increase the 6.times and add a logic to draw_item or the draw methods to know if they should print out a param or an xparam
How did you manage to do that?  I too would love to have ex-params show up for equipment.

I can see how to extend the left window down to allow for more lines, but I'm not sure where to find the specific width for what is now the lower right section to make it narrower so that it doesn't overlap the now extended left window.
To make the EquipItem part "get out of the way" I manually set it to be at a y of 208, and have a width of 420

In the default EquipItem Script, under object initialization I altered it to make it look like this

  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(x, y, width, height)    super(208, y, 420, height)    @actor = nil    @slot_id = 0  endJust a note, the 420 may need to be adjusted a bit to 430, or something. As you can see from my screenshot, there is a bit of space on the right because I didn't make it big enough yet.

as for adding the ex-params after, I'm off to bed now, but Ill try what Engr. Shana suggested in the morning, and let you know if it worked.
Thanks

EDIT

Adjusting to 431 does it as exactly as my eye can detect.
Alright, I tried to just simply replicate the refresh methods, changing all the params to xparam, but it keeps throwing errors, and every time I fix one, it sends me to another script (outside the Equip Window completely) with another error.

For example, I am now getting an error in the Game_BattlerBase Script that points me to an issue with line 268, and how '+' is not expected. I feel it has to do with refreshing more than 6 times, as there are only 6 params.

Color me confused as to exactly how to change this to have it work. :/

Next I'm going to try and make a separate window than the EquipStats one, and duplicate all the functions, but instead have it do the xparams. That way I can separate the param refresh from the xparam one as I can't figure out to have one refresh do both.

Any help would be appreciated.

Perhaps a talented scripter could make a script to allow for "modular" showing or hiding of up to 16 of the default ace stats (as there is room for that many as far as I can tell.)

Or maybe even have it fade between two sets of the stats on the screen. Like after 5 seconds, show the ex params. After 5 more seconds, show the SP params, and then back again.

EDIT : Seems just plain ol duplicating the entire script for a new window that contains the Xparams wont work, as the xparams don't have a vocab call. So I added

# ExParameters def self.xparam(xparam_id) # // Method to return xparam name. case xparam_id when 0 ; "Hit Chance" when 1 ; "Evasion" when 2 ; "Critical Chance" when 3 ; "Critical Evasion" when 4 ; "Magic Evasion" when 5 ; "Magic Reflection" when 6 ; "Counter Attack" when 7 ; "HP Regeneration" when 8 ; "MP Regeneration" when 9 ; "TP Regeneration" end endThis made it work... But then I had to actually edit the EquipScene base code to make the new window appear. Which it did.

But it is not displaying any of the values... just the text.

scriptrequestb_zps414ee4d8.jpg


At this point, I feel like a more experienced scripter... (who knows how to add windows and functions without editing the main code) would do better at this than I.
well, show us the code that you used to show the xparams... 🙂


to me it seems like you only replicated the draw xparam names and arrows part...


btw, if you did that self.xparam thing to game actor, I think that will cause a problem since game_battlerbase (the super parent of actor), has it's own xparam method which returns the values of the xparam... so you are actually overwriting it...


to get values for xparams, you simply need to do something like actor.xparam(xparam_id)
well, show us the code that you used to show the xparams... 🙂

to me it seems like you only replicated the draw xparam names and arrows part...

btw, if you did that self.xparam thing to game actor, I think that will cause a problem since game_battlerbase (the super parent of actor), has it's own xparam method which returns the values of the xparam... so you are actually overwriting it...

to get values for xparams, you simply need to do something like actor.xparam(xparam_id)
No. I added the self.xparam thing in the default Vocab script.

Here is the code I have in my replicated EquipStatus script. I called it EquipStatus2

Spoiler
#==============================================================================# ** Window_EquipStatus#------------------------------------------------------------------------------# This window displays actor xparameter changes on the equipment screen.#==============================================================================class Window_EquipStatusX < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y) super(x, 250, window_width, 300) @actor = nil @temp_actor = nil refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 208 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height fitting_height(visible_line_number) end #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number return 9 end #-------------------------------------------------------------------------- # * Set Actor #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear 9.times {|i| draw_item(0, line_height * (0 + i), 0 + i) } end #-------------------------------------------------------------------------- # * Set Temporary Actor After Equipment Change #-------------------------------------------------------------------------- def set_temp_actor(temp_actor) return if @temp_actor == temp_actor @temp_actor = temp_actor refresh end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(x, y, xparam_id) draw_xparam_name(x + 4, y, xparam_id) draw_current_xparam(x + 94, y, xparam_id) if @actor draw_right_arrow(x + 126, y) draw_new_xparam(x + 150, y, xparam_id) if @temp_actor end #-------------------------------------------------------------------------- # * Draw Parameter Name #-------------------------------------------------------------------------- def draw_xparam_name(x, y, xparam_id) change_color(system_color) draw_text(x, y, 80, line_height, Vocab::xparam(xparam_id)) end #-------------------------------------------------------------------------- # * Draw Current Parameter #-------------------------------------------------------------------------- def draw_current_xparam(x, y, xparam_id) change_color(normal_color) draw_text(x, y, 32, line_height, @actor.xparam(xparam_id), 2) end #-------------------------------------------------------------------------- # * Draw Right Arrow #-------------------------------------------------------------------------- def draw_right_arrow(x, y) change_color(system_color) draw_text(x, y, 22, line_height, "→", 1) end #-------------------------------------------------------------------------- # * Draw Post-Equipment Change Parameter #-------------------------------------------------------------------------- def draw_new_xparam(x, y, xparam_id) new_value = @temp_actor.xparam(xparam_id) change_color(param_change_color(new_value - @actor.xparam(xparam_id))) draw_text(x, y, 32, line_height, new_value, 2) endend
as you can see it is literally the exact same as the original, except it says xparam everywhere... except the last "param_change_color" because for some reason changing that one causes an error to throw. And I also removed the drawing of the actors name since it already displays in the top window.

So now, after realizing I needed to add a few lines of code to the Scene_Equip script, I have this...

scriptrequest3_zpse4fc89e1.png


It's showing the current stats, fine. But now I have an issue where the top box doesnt have enought room to show all the base stats... poor Luck 😛 .

Also, it still won't generate any "will be" stats on the right of the arrow. Not sure how to make that work.

Double Also... I wish I knew the code to make it display as a percent, and not a decimal...

If you are curious what i changed in the Scene_Equip script... here is the whole thing as is now...

Spoiler
#==============================================================================# ** Scene_Equip#------------------------------------------------------------------------------# This class performs the equipment screen processing.#==============================================================================class Scene_Equip < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_help_window create_status_window create_status_windowx create_command_window create_slot_window create_item_window end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_status_window @status_window = Window_EquipStatus.new(0, @help_window.height) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # * Create XStatus Window #-------------------------------------------------------------------------- def create_status_windowx @status_windowx = Window_EquipStatusX.new(0, @help_window.height) @status_windowx.viewport = @viewport @status_windowx.actor = @actor end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window wx = @status_window.width wy = @help_window.height ww = Graphics.width - @status_window.width @command_window = Window_EquipCommand.new(wx, wy, ww) @command_window.viewport = @viewport @command_window.help_window = @help_window @command_window.set_handler🙂equip, method🙂command_equip)) @command_window.set_handler🙂optimize, method🙂command_optimize)) @command_window.set_handler🙂clear, method🙂command_clear)) @command_window.set_handler🙂cancel, method🙂return_scene)) @command_window.set_handler🙂pagedown, method🙂next_actor)) @command_window.set_handler🙂pageup, method🙂prev_actor)) end #-------------------------------------------------------------------------- # * Create Slot Window #-------------------------------------------------------------------------- def create_slot_window wx = @status_window.width wy = @command_window.y + @command_window.height ww = Graphics.width - @status_window.width @slot_window = Window_EquipSlot.new(wx, wy, ww) @slot_window.viewport = @viewport @slot_window.help_window = @help_window @slot_window.status_window = @status_window @slot_window.actor = @actor @slot_window.set_handler🙂ok, method🙂on_slot_ok)) @slot_window.set_handler🙂cancel, method🙂on_slot_cancel)) end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_window wx = 0 wy = @slot_window.y + @slot_window.height ww = Graphics.width wh = Graphics.height - wy @item_window = Window_EquipItem.new(wx, wy, ww, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.status_window = @status_window @item_window.actor = @actor @item_window.set_handler🙂ok, method🙂on_item_ok)) @item_window.set_handler🙂cancel, method🙂on_item_cancel)) @slot_window.item_window = @item_window end #-------------------------------------------------------------------------- # * [Change Equipment] Command #-------------------------------------------------------------------------- def command_equip @slot_window.activate @slot_window.select(0) end #-------------------------------------------------------------------------- # * [Ultimate Equipment] Command #-------------------------------------------------------------------------- def command_optimize Sound.play_equip @actor.optimize_equipments @status_window.refresh @status_windowx.refresh @slot_window.refresh @command_window.activate end #-------------------------------------------------------------------------- # * [Remove All] Command #-------------------------------------------------------------------------- def command_clear Sound.play_equip @actor.clear_equipments @status_window.refresh @status_windowx.refresh @slot_window.refresh @command_window.activate end #-------------------------------------------------------------------------- # * Slot [OK] #-------------------------------------------------------------------------- def on_slot_ok @item_window.activate @item_window.select(0) end #-------------------------------------------------------------------------- # * Slot [Cancel] #-------------------------------------------------------------------------- def on_slot_cancel @slot_window.unselect @command_window.activate end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_item_ok Sound.play_equip @actor.change_equip(@slot_window.index, @item_window.item) @slot_window.activate @slot_window.refresh @item_window.unselect @item_window.refresh end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_item_cancel @slot_window.activate @item_window.unselect end #-------------------------------------------------------------------------- # * Change Actors #-------------------------------------------------------------------------- def on_actor_change @status_window.actor = @actor @status_windowx.actor = @actor @slot_window.actor = @actor @item_window.actor = @actor @command_window.activate endend Everything that says @status_windowx is what I added.
Hmmm... try adding debug lines to this

Code:
def draw_new_xparam(x, y, xparam_id)    new_value = @temp_actor.xparam(xparam_id)    change_color(param_change_color(new_value - @actor.xparam(xparam_id)))    draw_text(x, y, 32, line_height, new_value, 2)  end
Hmmm... try adding debug lines to this

def draw_new_xparam(x, y, xparam_id) new_value = @temp_actor.xparam(xparam_id) change_color(param_change_color(new_value - @actor.xparam(xparam_id))) draw_text(x, y, 32, line_height, new_value, 2) end
Gonna show my "newbie scripter" here, by simply blinking confusedly at what you just said.

What are Debug lines?
Debug messages are messages that tells you something that can help you determining why something doesn't work as you thought it would...

uhm try to replace that with this:

def draw_new_xparam(x, y, xparam_id) new_value = @temp_actor.xparam(xparam_id) p x p y p new_value change_color(param_change_color(new_value - @actor.xparam(xparam_id))) draw_text(x, y, 32, line_height, new_value, 2) endThen make sure you turn on the console before playtesting... then go to the equip screen and choose an equip and it should print values into your console...post the values here... I'm thinking that the temp actor doesn't get the features maybe... 🙂
I popped that in, but the console literally had nothing in it when i equipped an item.
EDIT: I found it I think... the temp_actor doesn't get made since that is done on another window...

so you need to add this,

Code:
class Window_EquipItem  attr_accessor :status_windowx  def update_help    super    if @actor && @status_window      temp_actor = Marshal.load(Marshal.dump(@actor))      temp_actor.force_change_equip(@slot_id, item)      @status_window.set_temp_actor(temp_actor)      @status_windowx.set_temp_actor(temp_actor)    end  endend
+ also replace create_item_window on your Scene_Equip with this
Code:
def create_item_window  wx = 0  wy = @slot_window.y + @slot_window.height  ww = Graphics.width  wh = Graphics.height - wy  @item_window = Window_EquipItem.new(wx, wy, ww, wh)  @item_window.viewport = @viewport  @item_window.help_window = @help_window  @item_window.status_window = @status_window  @item_window.status_windowx = @status_windowx  @item_window.actor = @actor  @item_window.set_handler(:ok, method(:on_item_ok))  @item_window.set_handler(:cancel, method(:on_item_cancel))  @slot_window.item_window = @item_windowend
It's now showing the before stats in the after stats side.

and now theres a bunch of text in the console...

150

0

0.6

150

24

0.15

1.50

etc etc.

EDIT : After adding the second part you added to your last post...

It threw and error. 

Undefined Method "status.windowx="
w8, I edited my last post... I think I found the problem...


and oh, undo the last change...
I undid the temp_actor to actor thing.

This time it threw another error.

Line 92

undefined method "xparam"

Wait...Where am I putting..

Code:
 class Window_EquipItem  attr_accessor :status_windowx  def update_help    super    if @actor && @status_window      temp_actor = Marshal.load(Marshal.dump(@actor))      temp_actor.force_change_equip(@slot_id, item)      @status_window.set_temp_actor(temp_actor)      @status_windowx.set_temp_actor(temp_actor)    end  endend 

 

?

 

Also... thanks for the help you are offereing.
I don't have any status.windowx there... where did you get that???


Line 92 of what???
Line 92 of the duplicated EquipStatus.

it says     new_value = @temp_actor.xparam(xparam_id)

right before the debug items you had me add.
that is weird, since temp actor is a copy of the actor so it is a Game_Actor so it should have xparam defined... else it shouldn't even be showing for the actor too...


can you post a screenshot of the exact error message?

Original thread: https://forums.rpgmakerweb.com/threads/showing-ex-param-changes-on-the-equip-screen.22290/