Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
Edited.

I'm using Yanfly Battle Engine, which does pop-ups for strong or weak hits. However, pop-ups are not feasible for my project. I would like to take those messages and push them to the Battle Log instead, but I can't for the life of me figure out how. I can't figure out how Yanfly actually got it to work in the first place, which is why piggybacking off of it as it is would be easiest.

I know that you can push a message to the log with the "add_text()" method, but only from within the right classes(?), so I can't just call that method at the point in the script where the pop-up would be displayed. Likewise, I can push a second message to the log at the point in the script where damage numbers are displayed in said log, but THAT part of the script can't reference the variable for the damage multipliers.

Thank you for any help.
 
Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,789
Reaction score
14,587
First Language
English
Primarily Uses
RMVXA
I use Yanfly's battle engine too, and the damage is in the log already so that part is done. Now if you want it to say resisted or weak as well, that might require editing the code and Yanfly didn't actually add to it, they just used the default code to put the message there. So you'd have to find that and edit it.

The pop-ups can be disabled too, there's code in there somewhere for it. I know as I added an extra popup to the engine myself, it took a little tweaking but it wasn't too bad. But I'm sure you can disable all popups pretty quickly, though you may need to disable it in more than just the Battle Engine as I do recall seeing it in other scripts of Yanfly too.
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
I mean, it's just that the part that puts the damage in the log, and the part that displays a pop-up for the weakness/resistance, seem to be entirely different sections that can't talk to each other easily.

Having slept on it, the best I could come up with is to write in my own custom, insanely long if/then tree right after the damage message to determine expected weakness/resistance by reading the skill ID, target ID, an array containing every "fire" spell in the game, and whether the target has an element (via states). Luckily I found ways to reference these things from there. It'll be a pain but it should, theoretically, work. :kaoswt2:
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
You dont need an array of every fire spell just to check if its fire because if you know the skill, you can simply get its element_id value and see if it corresponds to fire. You can also check the target's fire resistance value via getting the approriate trait.
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
You dont need an array of every fire spell just to check if its fire because if you know the skill, you can simply get its element_id value and see if it corresponds to fire. You can also check the target's fire resistance value via getting the approriate trait.

EDIT:
Tried it out, no luck.
undefined method 'element_id' for #<RPG::Skill:0xf61d6a4>
Possibly a problem with the Yanfly engine, I don't know.

For the record, this is within the display_hp_damage method of the Window_BattleLog class, as aliased in Yanfly's Battle Engine. The method is receiving two variables, "item" (which seems to be the skill), and "target". I tested it by way of the following line:
add_text(item.element_id)
 
Last edited:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Its a wrong call, I just said element_id but I'm actually not sure that its the right one.

Try doing a global search (Ctrl+shift+f) in the script editor for elem and see what things come up. I'm not with my maker right now so I cant pick the right call
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
It was item.damage.element_id. But, as feared, it only shows the system-assigned one, so I'll still need to make a list of the secondary elements. It does save some time, though, so thank you for your help. :kaohi:
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
So your game uses two elements per skill or something?
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
Some of them, yes. Sorry, I thought I had mentioned that. :kaoswt:
Lest you wonder, the secondary element is essentially for slashing/piercing/blunt. It uses one of Victor Sant's scripts to set additional elements in the skill's notetags.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
I see. In that case, studying Victor's script should lead you to discover how to quickly determine the second element, or you can simply learn how to read notetags and load them yourself. Doing so, you wont need a list for the second elements too.
 

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
252
Reaction score
179
First Language
English
Primarily Uses
RMVXA
Honestly, at this point the process has been simplified enough to just use the list method for the rest, since the game is near completion and the applicable skills are set in stone. Again, thanks for the help.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
I see. If you're fine with that then that's good, its something you can look at in the future though :)
 

Latest Threads

Latest Profile Posts

Minecraft Tiles, Maid Day, Custom Menu, Retry at GameOver, Save in Appdata | RPG Maker News #36

side view special bust.png
Reworking the art for the 'special busts' in important game dialogue. Potentially replacing the more 'dead-on' look of the original:
original.png
Me: Imma work on my game! Let's get some progress done
Me, five minutes later smoking a cigarette: *screams into the void*
Just got back from work... I got to recommend a dish I liked to a group of senior ladies, and they said they'd order it for dessert! What was it? CHURROS! It's one of my favorite desserts at my workplace.
What's your favorite dessert? I'll eat any pastry with cinnamon and sugar, but especially churros. And then there's chocolate... omg, so good!
Is it just me, or are img tags suddenly broken on the forum?

Forum statistics

Threads
111,251
Messages
1,059,591
Members
144,526
Latest member
Tiffypowers79
Top