I know in some games, people towards the front of the party are more likely to get hit by enemies. Is this true for MZ by default?
How much does formation matter?
RPG Maker MZ SupportKind of. Every actor has a target rate parameter (sp-parameter in the traits list).
When an enemy is choosing a target, they roll a random number, then go through the party list seeing if that actor's target rate is large enough to be chosen as the target.
So the target rate can weight it quite a bit, but it does technically look in party order, so if the roll was low enough (or if everyone has the same target rate), being lower in party order makes you more likely to be hit.
When an enemy is choosing a target, they roll a random number, then go through the party list seeing if that actor's target rate is large enough to be chosen as the target.
So the target rate can weight it quite a bit, but it does technically look in party order, so if the roll was low enough (or if everyone has the same target rate), being lower in party order makes you more likely to be hit.
by default, the formation screen is the only way for the player to change party order.
also by default, the first four party members are the battle members, and everyone in fifth or later positions are the reserve members that do not participate in battle.
so the formation decides which actors are available in battle if your party is larger than four people.
additionally, the developer can decide (database system 1 tab, "EXP for reserve members") if the reserve members get the same EXP as the battlemembers or not.
So if your party has a maximum of four members, the formation screen has absolutely no technical use.
But if you have five or more members in your party, the formation becomes your key to success as it determines which actors are in the battle or not.
(while the target rate is handled like @ATT_Turan describes in the post above, the effects of changing position 1 to 4 on the probability of being targeted are neglegtable. No random generator ever is truly equidistant, but the target rates are scaled and added before the target roll and the generator is good enough that you would need several thousand rolls to detect the difference in target probability.)
also by default, the first four party members are the battle members, and everyone in fifth or later positions are the reserve members that do not participate in battle.
so the formation decides which actors are available in battle if your party is larger than four people.
additionally, the developer can decide (database system 1 tab, "EXP for reserve members") if the reserve members get the same EXP as the battlemembers or not.
So if your party has a maximum of four members, the formation screen has absolutely no technical use.
But if you have five or more members in your party, the formation becomes your key to success as it determines which actors are in the battle or not.
(while the target rate is handled like @ATT_Turan describes in the post above, the effects of changing position 1 to 4 on the probability of being targeted are neglegtable. No random generator ever is truly equidistant, but the target rates are scaled and added before the target roll and the generator is good enough that you would need several thousand rolls to detect the difference in target probability.)
I think these are the main cases:
As always, though, plugins can change any game mechanic.
- Substitution - if an ally is attacked when at critical (< 25%) HP, the first living member with a Substitute trait will take the hit for them. So, for example, if you have 2 Substitute members, the one behind will never substitute for the one in front.
- Full-unit effects - things that target a whole unit (e.g. an All Enemies scope skill) do so in order, leader first. This can tie in with the Substitute trait, for example: if your leader is the tank and they're low on HP, they might die from the hit, leaving the rest of the party unprotected; if they're at the back, they could at least take a hit for the leader instead.
- Inventory user - if you use an item from the inventory menu, the user will be the first party member with the highest PHA value. E.g. if all party members have 150% PHA, the item user will be the party leader. This can matter for items that affect the user as well as the target.
Math.random produces values with 52-bit precision, so like Andar says, the effect of party ordering on a weighted random pick is typically negligible. Most player issues with RNG are due to a poor understanding of what randomness is, coupled with natural human pareidolia, e.g. the "clustering illusion".)As always, though, plugins can change any game mechanic.
Does this happen? Can a battler Substitute during an all whatever attack and take two hits from it? Or is this more if you're, say, using action sequences with the target action field, so it's hitting the whole unit but treating them as individual hits?
It's never come up for me.
@ATT_Turan @caethyril
I vaguely remember another point that might have added to the misconception of hitting low number battlers more often: a bug-default.
I don't remember which maker it was or which plugin (although now that I think about it again, it was likly one of yanfly's lunatic targeting), but when a skill was already processing and the targeting selection comes back empty for whatever reason, the skill defaults to the first index even if the random number was something else.
Since the default engine doesn't filter targets it was likely in combination with a plugin that introduces such filtering, to prevent bad lunatic code from wasting the action.
But since most people use many yanfly plugin without understanding them (or knowing everything they do), such a default in one of them could easily cause the misconception that the random generator hits the first actor more often.
I vaguely remember another point that might have added to the misconception of hitting low number battlers more often: a bug-default.
I don't remember which maker it was or which plugin (although now that I think about it again, it was likly one of yanfly's lunatic targeting), but when a skill was already processing and the targeting selection comes back empty for whatever reason, the skill defaults to the first index even if the random number was something else.
Since the default engine doesn't filter targets it was likely in combination with a plugin that introduces such filtering, to prevent bad lunatic code from wasting the action.
But since most people use many yanfly plugin without understanding them (or knowing everything they do), such a default in one of them could easily cause the misconception that the random generator hits the first actor more often.
I just tested to be sure, and yes. My test case was:
- Default party (Reid, Priscilla, Gale, Michelle);
- Make sure Michelle is the only one with a Substitute trait;
- Make an enemy that uses the default Dust Devil skill (Physical Hit, All Enemies);
- Start a battle test;
- Console ->
$gameParty.leader().setHp(5)("set Reid's HP to 5"); - Guard until the enemy uses Dust Devil;
- Watch as Michelle takes Reid's hit and her own.
BattleManager.invokeAction (rmmz_managers.js) for more details~[Edited: substitute applies to Magical Hit actions, not just Physical Hit.]
Good point, that reminds me of the
smoothTarget logic in the MV/MZ core scripts (not sure how VX Ace etc handle it). With the default Turn-Based system it's possible to select a target that will be ineligible, e.g. dead, by the time the action is actually performed. smoothTarget works around this by replacing an ineligible target with the first valid target (rmmz_objects.js):
JavaScript:
Game_Unit.prototype.smoothTarget = function(index) {
const member = this.members()[Math.max(0, index)];
return member && member.isAlive() ? member : this.aliveMembers()[0];
};
You didn't have to go through all that! 🤣
Like I said, it's never come up for me - I don't use Substitute, so I've never seen nor bothered to look up how it works with multi-target attacks. But thanks for the info.
Original thread: https://forums.rpgmakerweb.com/threads/how-much-does-formation-matter.147976/