[RMMV] [RMVX ACE] [RM2K3] THE MAKER MATHS THREAD
Posts
Pages:
1
Okay, so this is not STRICTLY programming but it's a very closely related topic: how the default formulas (or the formulas after modification by various common or even nigh-ubiquitous scripting/plugins) actually work. I remember I either made a topic about this in the past or asked a bunch of questions about this in the past possibly in the "What are you thinking about (game development)?" thread but as I cannot remember which or where, I figured it was worth making a new topic rather than invoking necromancy.
I tagged three different engines in the subject because those three seem to be the most widely used. This does not mean if you have a question about how the default math/formulas works in say, RMXP, RM2k, or VX you aren't allowed to ask it here. I DON'T HAVE THE POWER TO MAKE RULES LIKE THAT. But I do very much want people other than me to be able to ask their RM math related questions here and have other other people more knowledgeable than me answer them. (In the event I actually know the answer to something, I'll happily pitch in.)
I'll start with the question that prompted this thread. Format your questions this way if you don't mind, might make it easier to index this knowledge later on.
(I found this stuff was easier to puzzle out on my own in RPG Maker VX Ace because you could CTRL + SHIFT + F through all the default RGSS scripts that made up the game engine looking for an answer. If there's an equivalent way to do that with the "core" JavaScript that makes up RMMV, I don't know what it is.)
Engine: RPG Maker MV
Relevant Plugins/Scripts: None, I think.
In the skills tab of the database, in the "Invocation" section, the second field is Success (percentage). Hovering mymouth mouse (wow that's a hilarious typo if you think about it) over that parameter gave me the following less than useful tooltip: "Probability that the use of the action succeeds". That tells me none of what I need to know:
Your questions don't need to include examples and the examples don't need to be as long as mine was if you do include them and yes, I would like an answer to the sample question if anyone has one, it was not just for show. I do think it's important that you name the engine you're asking about, both so the answer can be cataloged properly and because I strongly suspect the under-the-hood math has been at least slightly different in every single version of RPG Maker ever released.
I tagged three different engines in the subject because those three seem to be the most widely used. This does not mean if you have a question about how the default math/formulas works in say, RMXP, RM2k, or VX you aren't allowed to ask it here. I DON'T HAVE THE POWER TO MAKE RULES LIKE THAT. But I do very much want people other than me to be able to ask their RM math related questions here and have other other people more knowledgeable than me answer them. (In the event I actually know the answer to something, I'll happily pitch in.)
I'll start with the question that prompted this thread. Format your questions this way if you don't mind, might make it easier to index this knowledge later on.
(I found this stuff was easier to puzzle out on my own in RPG Maker VX Ace because you could CTRL + SHIFT + F through all the default RGSS scripts that made up the game engine looking for an answer. If there's an equivalent way to do that with the "core" JavaScript that makes up RMMV, I don't know what it is.)
Engine: RPG Maker MV
Relevant Plugins/Scripts: None, I think.
In the skills tab of the database, in the "Invocation" section, the second field is Success (percentage). Hovering my
- If the action fails, does it register as a "Failed" on the user or as a "Miss" on the target?
- I assume if Hit Type is set to "Guaranteed Hit" that the number in this box is the absolute percentage chance that the skill will hit?
- If hit type is set to Physical Attack, how does "Success" interact with the target's Evasion? Does the engine first check to see if the skill succeeds, then check to see if the target evades, separately? Or does it combine together? I.E. does a skill with a 90% "Succeed" chance used against a target with 10% Evasion actually have an 81% chance of hitting?
- Same basic question but if hit type is set to Magical Attack. If a spell has an 80% succeed rate and the target has 25% Magic Evasion, is the real chance the spell will hit 60%? Or is it checked separately?
Your questions don't need to include examples and the examples don't need to be as long as mine was if you do include them and yes, I would like an answer to the sample question if anyone has one, it was not just for show. I do think it's important that you name the engine you're asking about, both so the answer can be cataloged properly and because I strongly suspect the under-the-hood math has been at least slightly different in every single version of RPG Maker ever released.
I think the key to answering the question in the OP lies in Game_Battler, or it's equivalent. I'll use VX Ace as my example as that's what I have installed right now.
So, it looks like, at least in this case, it checks whither or not the item/skill hits first, based on it's "success rate", multiplied by the user's hit-rate. In your example, the base rate of hitting/succeeding would be 66.5% (0.7 * 0.95 = 0.665). Assuming it hit, it would then check for evasion. Making your assumption about it checking to see if a target is hit separately from checking for evasion correct. It's probably safe to assume that the other engines work similarly?
I will note that there is apparently no "else" case to handle "@result.hit? == false" in the above function. There is nothing to process, except the "Missed!" message, or whatever, which is set up...
...as part of the battle log functionality.
class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # * Calculate Hit Rate of Skill/Item #-------------------------------------------------------------------------- def item_hit(user, item) rate = item.success_rate * 0.01 # Get success rate rate *= user.hit if item.physical? # Physical attack: Multiply hit rate return rate # Return calculated hit rate end #-------------------------------------------------------------------------- # * Calculate Evasion Rate for Skill/Item #-------------------------------------------------------------------------- def item_eva(user, item) return eva if item.physical? # Return evasion if physical attack return mev if item.magical? # Return magic evasion if magic attack return 0 end #-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) if @result.hit? unless item.damage.none? @result.critical = (rand < item_cri(user, item)) make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end end end
So, it looks like, at least in this case, it checks whither or not the item/skill hits first, based on it's "success rate", multiplied by the user's hit-rate. In your example, the base rate of hitting/succeeding would be 66.5% (0.7 * 0.95 = 0.665). Assuming it hit, it would then check for evasion. Making your assumption about it checking to see if a target is hit separately from checking for evasion correct. It's probably safe to assume that the other engines work similarly?
I will note that there is apparently no "else" case to handle "@result.hit? == false" in the above function. There is nothing to process, except the "Missed!" message, or whatever, which is set up...
class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # * Display Action Results #-------------------------------------------------------------------------- def display_action_results(target, item) if target.result.used last_line_number = line_number display_critical(target, item) display_damage(target, item) display_affected_status(target, item) display_failure(target, item) wait if line_number > last_line_number back_to(last_line_number) end end #-------------------------------------------------------------------------- # * Display Failure #-------------------------------------------------------------------------- def display_failure(target, item) if target.result.hit? && !target.result.success add_text(sprintf(Vocab::ActionFailure, target.name)) wait end end end
...as part of the battle log functionality.
author=StormCrow
(I found this stuff was easier to puzzle out on my own in RPG Maker VX Ace because you could CTRL + SHIFT + F through all the default RGSS scripts that made up the game engine looking for an answer. If there's an equivalent way to do that with the "core" JavaScript that makes up RMMV, I don't know what it is.)
If you install a text editor like notepad++ or vscode, you can ctrl+shift+f in the editor to search all the javascript in your project. Other editors may have a different hotkey, but the function is often "find in files" or "search in files"
There's no javascript editor built in to MV, but they're just text files in your project so easy to edit externally.
If you decide to version control your projects, the MV style is more friendly than the Ace way.
I should get Notepad++, thanks for the tip. It hadn't occurred to me that another program could search across multiple different files.
Are the core JS files created and copied into every new project's data section like the RTP is into the img and audio folders in MV?
Are the core JS files created and copied into every new project's data section like the RTP is into the img and audio folders in MV?
Pages:
1















