Showing variables in Weapon-Description

Hello kind people,

I am currently working on a dynamic system to merge weapons with items to improve them (meaning the weapons are created by merging, not predefined). For that purpose I need to store all stats in variables instead of what will then be more or less pseudo-weapons. I still want to give the player the chance to marvel at their awesome weapons though. So is there any way to show variables in the description of weapons?
If -what I imagine after a futile websearch- that is not the case, I'd very much appreciate some ideas on how to approach such a problem.

Thanks
Musikcookie
Moved to: RGSS3 Script Requests

You will need a script to include variables in weapon names/descriptions, but I believe there are already scripts out there that do weapon-crafting.
Moved to: RGSS3 Script Requests

You will need a script to include variables in weapon names/descriptions, but I believe there are already scripts out there that do weapon-crafting.
Thank you for your answer. I have already learned a bit of scripting basics some time ago, so I guess I'll have another look at that. I know there are probably scripts for everything, but I want to see, how far I can get without copy pasting stuff. ^^
search for modern algebra's scripts. His advanced text system as well as global text codes will allow you to do what you want as that set of scripts has much more options than yanfly's message system for Ace.
No, you do not need a script to display the value of a variable in item descriptions.

The engine already has a text code for it: "\v[n]". The same code you use in message windows to display the contents of game variables there. The "n" is meant to be the index number of the game variable containing the information you want (as in, variables set by the Control Variable event command, which can be manually accessed through the "$game_variables[]" array).

You DO however need a script to display variables in item NAMES. Text codes are only processed when text is drawn using the "draw_text_ex()" Method rather than "draw_text()". Item descriptions use this Method to display, but items names are drawn using "draw_item_name()" which ends up calling the basic "draw_text()" to display.

At the minimum, you would need to modify "draw_item_name()" to use "draw_text_ex()" instead, if you wanted it to accept text codes (and then do further modifications to re-implement the resizing/squishing of text to fit the window if the item name is too long since "draw_text_ex()" excludes the functionality that squishes text to fit that "draw_text()" provides).
No, you do not need a script to display the value of a variable in item descriptions.

The engine already has a text code for it: "\v[n]". The same code you use in message windows to display the contents of game variables there. The "n" is meant to be the index number of the game variable containing the information you want (as in, variables set by the Control Variable event command, which can be manually accessed through the "$game_variables[]" array).

You DO however need a script to display variables in item NAMES. Text codes are only processed when text is drawn using the "draw_text_ex()" Method rather than "draw_text()". Item descriptions use this Method to display, but items names are drawn using "draw_item_name()" which ends up calling the basic "draw_text()" to display.

At the minimum, you would need to modify "draw_item_name()" to use "draw_text_ex()" instead, if you wanted it to accept text codes (and then do further modifications to re-implement the resizing/squishing of text to fit the window if the item name is too long since "draw_text_ex()" excludes the functionality that squishes text to fit that "draw_text()" provides).
i don't think \v[n] work in item description in ACE by default... you might need script to enable that feature... modern algebra global text code script might work i think...
Thank you all! This forum is great! ^^
I will definitely check some premade scripts out but also try to think of a system that will reduce the complexity of what I want to do.
The engine already has a text code for it: "\v[n]". The same code you use in message windows to display the contents of game variables there.
the question was for Ace, not for MV - that function was not yet expanded to the database in Ace.
the question was for Ace, not for MV - that function was not yet expanded to the database in Ace.
i don't think \v[n] work in item description in ACE by default... you might need script to enable that feature... modern algebra global text code script might work i think...
I tested it in Ace myself before I posted.

Text codes are processed by the "draw_text_ex" method in Ace, it doesn't matter where the string is coming from, whether it's from the database or event command or external file, if it contains the characters for a text code and it is being processed by "draw_text_ex" it will alter the string to replace the text code with the relevant value (see "convert_escape_characters" in Window_Base, which is called by "draw_text_ex").

The window that displays item descriptions is Window_Help. Window_Help uses "draw_text_ex" to display its text.

Window_ItemList is what displays the names. That one doesn't use "draw_text_ex", it uses "draw_item_name", which boils down to plain "draw_text".
I tested it in Ace myself before I posted.

Text codes are processed by the "draw_text_ex" method in Ace, it doesn't matter where the string is coming from, whether it's from the database or event command or external file, if it contains the characters for a text code and it is being processed by "draw_text_ex" it will alter the string to replace the text code with the relevant value (see "convert_escape_characters" in Window_Base, which is called by "draw_text_ex").

The window that displays item descriptions is Window_Help. Window_Help uses "draw_text_ex" to display its text.

Window_ItemList is what displays the names. That one doesn't use "draw_text_ex", it uses "draw_item_name", which boils down to plain "draw_text".
really?? i don't remember correctly then 😀...
i have already uninstalled my ACE long ago... so i might be wrong 😀...
@Traverse then either you have already installed scripts for that in your project, or there was a massive update in the last version of Ace - because the early version definately did NOT work that way, many Ace projects need the global textcode script for that function.

Original thread: https://forums.rpgmakerweb.com/threads/showing-variables-in-weapon-description.134583/