Simulating a Skill Formula oustide of battle?

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
85
First Language
English
Primarily Uses
RMVXA
Been experimenting trying to create a window in Scene_Skill that shows hypothetical damage output of a given skill. This is easier said than done, however, as I'm having an increasing amount of trouble getting the program to return a numeric value from the skill's formula outside of battle. I'm doing this by simulating an @actor argument in the Window class and $data_enemies[999] which is just a dummy with 0 Defense. All I did after that was use @skill.damage.formula, then @actor.send(formula), but that returns an error even when the exact method is defined under Game_Battler.

I can give more examples/actual code if needed, but I'm curious if anyone knows an immediate solution to return a value for a given skill outside of battle using a hypothetical enemy. I found the precise method "make_damage_value(user, item)" but not only does it straight up return 0, it also calculates a lot of things I don't want (I only want to simulate the formula, without variance or crit).

If anyone has any idea on how to do this, I'd be more than appreciative.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
536
Reaction score
249
First Language
German
Primarily Uses
Hey there,

You were on the right track, the evaluation of the damage formula is shown in the first line of that method:
item.damage.eval(user, self, $game_variables)

However, $data_enemies[X] is probably incompatible with most formulas. The easiest way to get a target dummy would be to use $game_actors[X] with an unused actor instead. ($data_enemies and $data_actors only contain your database settings and have a different layout than actual battlers.)
 

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
85
First Language
English
Primarily Uses
RMVXA
Great catch! I did try that method but like a numbskull, still tried to use $data_enemies. I created a dummy actor as you instructed and it works beautifully. Thanks a ton!
 

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

Latest Threads

Latest Profile Posts

Eh... just the three of us killing mosquitoes and collecting them. Current kill count: 14.
Been watching videos about IRS phone scammers. Some really scummy people in the world.
Is the "2 status updates per 24h" still in effect?
My first attempt at Pixel Art :blink::) (I have no idea what I'm doing but I'm doing it)
Plugin instructions: *exists*
Plugin: What did he say? *error*

Forum statistics

Threads
93,725
Messages
914,952
Members
123,330
Latest member
Rikuto
Top