Hi guys, a little help. If you become too strong, you become invincible versus weak enemies. How can you set that even the player def is high then the enemy attack, the enemy can still do a little damage? Not elevate, but not zero...? Is it possible?
Damage can't go to Zero?
RPG Maker MV SupportIt's possible with some creativity on the damage formulas. Usually the easiest way is to call a function which returns the maximum of your damage and 1, and if the damage is somehow less than 1, it returns 1. Unfortunately I don't know the command to call the maximum in JavaScript, maybe someone else knows it?
Otherwise, I believe Yanfly has a plug-in that lets you set a minimum damage, if you don't want to touch the damage formula.
Otherwise, I believe Yanfly has a plug-in that lets you set a minimum damage, if you don't want to touch the damage formula.
So, in a yanfly's plugin there is a way to set that thing? A minimum damage "random"?
It's not random, its a fixed number. Its good if you want to make sure it is never less than 1 for example. But if you want it to be a fixed % of something, or slightly random, you'll need to get creative with the damage formula.
Try something like this:
Math.max(1, originalDamageFormula)
To add random into the max, try:
Math.max(Math.floor(Math.random() * x) + 1, originalDamageFormula)
Where Math.floor(Math.random() * x) should return an integer between 0 and x - 1.
Math.max(1, originalDamageFormula)
To add random into the max, try:
Math.max(Math.floor(Math.random() * x) + 1, originalDamageFormula)
Where Math.floor(Math.random() * x) should return an integer between 0 and x - 1.
Or simply Math.randomInt(X)
Uhm... i'm a little confused... the formula standard is, if i remember, something like a.atk*2 - b.def. If i wanna use this type of damage formula and "integrate" that?
You may want to try this:
Code:
Math.max(Math.randomInt(x) + 1, a.atk * 2 - b.def)
Thank you very much. I want to understand the formula. Can you explain me the definition and what can do what? For example, the random number is setted with X. How can i set a range of that random number? for example "from 1 to 100. Take me a random number in that range".
Replace x with the maximum you wish the minimum damage to be. So if you want it to be from 1 - 100, replace x with 100.
In this case you can replace x with 100.
Of course, the resulting damage formula can be a bit tricky.
If a.atk * 2 - b.def is always greater than 100, than the damage formula will effectively become a.atk * 2 - b.def.
On the other hand, if a.atk * 2 - b.def can be smaller than or equal to 100, than the damage formula will first generate a random number between 1 and 100, and return that random number if it's greater than a.atk * 2 - b.def, or a.atk * 2 - b.def otherwise.
To fully utilize the damage formula without involving any plugin, you'll have to have some RMMV plugin development proficiency(inexperienced RMMV plugin developer having a basic knowledge on the default RMMV codebase and written several easy, simple and small RMMV plugins without nontrivial bugs).
But usually, having a basic knowledge on what the following building block does locally can already give you a drastically higher control and freedom on the damage formula:
Intermediate:
Advanced:
If you wish to learn more, you may want to understand rpg_objects.js(Game_BattlerBase, Game_Battler, Game_Actor, Game_Enemy should be your main focus) 🙂
Of course, the resulting damage formula can be a bit tricky.
If a.atk * 2 - b.def is always greater than 100, than the damage formula will effectively become a.atk * 2 - b.def.
On the other hand, if a.atk * 2 - b.def can be smaller than or equal to 100, than the damage formula will first generate a random number between 1 and 100, and return that random number if it's greater than a.atk * 2 - b.def, or a.atk * 2 - b.def otherwise.
To fully utilize the damage formula without involving any plugin, you'll have to have some RMMV plugin development proficiency(inexperienced RMMV plugin developer having a basic knowledge on the default RMMV codebase and written several easy, simple and small RMMV plugins without nontrivial bugs).
But usually, having a basic knowledge on what the following building block does locally can already give you a drastically higher control and freedom on the damage formula:
Elementary:
Spoiler
// Game battler
a.hit // The HIT of subject
a.eva // The EVA of subject
a.cri // The CRI of subject
a.cev // The CEV of subject
a.mev // The MEV of subject
a.mrf // The MRF of subject
a.cnt // The CNT of subject
a.hrg // The HRG of subject
a.mrg // The MRG of subject
a.trg // The TRG of subject
a.tgr // The TGR of subject
a.grd // The GRD of subject
a.rec // The REC of subject
a.pha // The PHA of subject
a.mcr // The MCR of subject
a.tcr // The TCR of subject
a.pdr // The PDR of subject
a.mdr // The MDR of subject
a.fdr // The FDR of subject
a.exr // The EXR of subject
// Game actors
$gameActors.actor(actorId) // The actor with id actorId; Initializes that actor if he/she/it doesn't already exist
// Game party/game troop
$gameParty.members()[index] // The (index + 1)th party member
$gameTroop.members()[index] // The (index + 1)th troop member
$gameParty.aliveMembers()[index] // The (index + 1)th alive party member
$gameTroop.aliveMembers()[index] // The (index + 1)th alive troop member
$gameParty.deadMembers()[index] // The (index + 1)th dead party member
$gameTroop.deadMembers()[index] // The (index + 1)th dead troop member
$gameParty.movableMembers()[index] // The (index + 1)th movable party member
$gameTroop.movableMembers()[index] // The (index + 1)th movable troop member
// Game switches
$gameSwitches.value(switchId) // The status of switch with id switchId
// Game system
$gameSystem.battleCount() // The number of battles fought
$gameSystem.winCount() // The number of battles won
$gameSystem.escapeCount() // The number of battles escaped
$gameSystem.saveCount() // The number of saves taken
$gameSystem.playTime() // The number of seconds the current game has lasted
// Math
Math.min(x, y) // The minimum Number of Number x and Number y
Math.max(x, y) // The maximum Number of Number x and Number y
Math.pow(x, y) // The Number x ^ y
Math.abs(x) // The absolute value of Number x
Math.ceil(x) // The integer that is just not smaller than Number x
Math.floor(x) // The integer that is just not larger than Number x
Math.round(x) // The integer that is the closest to Number x
Math.sign(x) // -1 if Number x is negative; 0 if Number x is 0; 1 if Number x is positive
Math.trunc(x) // The integral part of Number x
Math.random() // A random Number not smaller than 0 but smaller than 1
Spoiler
// Game battler
a.hit // The HIT of subject
a.eva // The EVA of subject
a.cri // The CRI of subject
a.cev // The CEV of subject
a.mev // The MEV of subject
a.mrf // The MRF of subject
a.cnt // The CNT of subject
a.hrg // The HRG of subject
a.mrg // The MRG of subject
a.trg // The TRG of subject
a.tgr // The TGR of subject
a.grd // The GRD of subject
a.rec // The REC of subject
a.pha // The PHA of subject
a.mcr // The MCR of subject
a.tcr // The TCR of subject
a.pdr // The PDR of subject
a.mdr // The MDR of subject
a.fdr // The FDR of subject
a.exr // The EXR of subject
// Game actors
$gameActors.actor(actorId) // The actor with id actorId; Initializes that actor if he/she/it doesn't already exist
// Game party/game troop
$gameParty.members()[index] // The (index + 1)th party member
$gameTroop.members()[index] // The (index + 1)th troop member
$gameParty.aliveMembers()[index] // The (index + 1)th alive party member
$gameTroop.aliveMembers()[index] // The (index + 1)th alive troop member
$gameParty.deadMembers()[index] // The (index + 1)th dead party member
$gameTroop.deadMembers()[index] // The (index + 1)th dead troop member
$gameParty.movableMembers()[index] // The (index + 1)th movable party member
$gameTroop.movableMembers()[index] // The (index + 1)th movable troop member
// Game switches
$gameSwitches.value(switchId) // The status of switch with id switchId
// Game system
$gameSystem.battleCount() // The number of battles fought
$gameSystem.winCount() // The number of battles won
$gameSystem.escapeCount() // The number of battles escaped
$gameSystem.saveCount() // The number of saves taken
$gameSystem.playTime() // The number of seconds the current game has lasted
// Math
Math.min(x, y) // The minimum Number of Number x and Number y
Math.max(x, y) // The maximum Number of Number x and Number y
Math.pow(x, y) // The Number x ^ y
Math.abs(x) // The absolute value of Number x
Math.ceil(x) // The integer that is just not smaller than Number x
Math.floor(x) // The integer that is just not larger than Number x
Math.round(x) // The integer that is the closest to Number x
Math.sign(x) // -1 if Number x is negative; 0 if Number x is 0; 1 if Number x is positive
Math.trunc(x) // The integral part of Number x
Math.random() // A random Number not smaller than 0 but smaller than 1
Intermediate:
// Flow control
boolean ? x : y // Executes x if boolean is truthy, or executes y if boolean is falsy
if (boolean) x; y // Executes x if boolean is truthy; Always executes y afterwards regardless of whether boolean is truthy
if (boolean) x else y; z // Executes x if boolean is truthy or executes y if otherwise; Always executes z afterwards regardless of whether boolean is truthy
boolean ? x : y // Executes x if boolean is truthy, or executes y if boolean is falsy
if (boolean) x; y // Executes x if boolean is truthy; Always executes y afterwards regardless of whether boolean is truthy
if (boolean) x else y; z // Executes x if boolean is truthy or executes y if otherwise; Always executes z afterwards regardless of whether boolean is truthy
Advanced:
// Common
a.clearStates() // Removes all states from the subject
a.eraseState(stateId) // Removes state with id stateId from the subject
a.isStateAffected(stateId) // Returns true if the subject has state with id stateId, or returns false otherwise
a.resetStateCounts(stateId) // Resets the remaining turns of state with id stateId as its initial value for the subject
a.clearBuffs() // Revmoes all buffs and debuffs from the subject
a.eraseBuff(paramId) // Removes the buff/debuff of param with id paramId from the subject
a.increaseBuff(paramId) // Increases the buff level of param with id paramId for the subject
a.decreaseBuff(paramId) // Decreases the buff level of param with id paramId for the subject
a.overwriteBuffTurns(paramId, turns) // Resets the remaining turns of buff/debuff of param with id paramId for the subject as turn, if turn's larger than the current remaining turn)
a.die() // Kills the subject
a.revive() // Revives the subject
a.isStateResist(stateId) // Returns true if the subject's resist to state with id stateId, or returns false otherwise
a.setHp(hp) // Sets the hp of the subject as hp
a.setMp(mp) // Sets the mp of the subject as mp
a.setTp(tp) // Sets the tp of the subject as tp
a.isActor() // Returns true if the subject's an actor, or returns false otherwise
a.isEnemy() // Returns true if the subject's an enemy, or returns false otherwise
a.addNewState(stateId) // Adds state with id stateId to the subject
// Rare
a.buffLength() // Returns the number of params having buffs/debuffs for the subject
a.buff(paramId) // Returns the buff level of param with id paramId for the subject(negative means debuff)
a.elementRate(elementId) // The element rate of element with id elementId for the subject
a.debuffRate(paramId) // The debuff rate of param with id paramId for the subject
a.stateRate(stateId) // The state rate of state with id stateId fot the subject
a.attackSpeed() // The speed of attack for the subject
a.attackTimesAdd() // The attack times add for the subject
a.isSkillTypeSealed(stypeId) // Returns true if the skill type with id stypeId is sealed for the subject, or returns false otherwise
a.isSkillSealed(skillId) // Returns true if the skill with id skillId is sealed for the subject, or returns false otherwise
a.speed() // The speed of the subject
a.clearStates() // Removes all states from the subject
a.eraseState(stateId) // Removes state with id stateId from the subject
a.isStateAffected(stateId) // Returns true if the subject has state with id stateId, or returns false otherwise
a.resetStateCounts(stateId) // Resets the remaining turns of state with id stateId as its initial value for the subject
a.clearBuffs() // Revmoes all buffs and debuffs from the subject
a.eraseBuff(paramId) // Removes the buff/debuff of param with id paramId from the subject
a.increaseBuff(paramId) // Increases the buff level of param with id paramId for the subject
a.decreaseBuff(paramId) // Decreases the buff level of param with id paramId for the subject
a.overwriteBuffTurns(paramId, turns) // Resets the remaining turns of buff/debuff of param with id paramId for the subject as turn, if turn's larger than the current remaining turn)
a.die() // Kills the subject
a.revive() // Revives the subject
a.isStateResist(stateId) // Returns true if the subject's resist to state with id stateId, or returns false otherwise
a.setHp(hp) // Sets the hp of the subject as hp
a.setMp(mp) // Sets the mp of the subject as mp
a.setTp(tp) // Sets the tp of the subject as tp
a.isActor() // Returns true if the subject's an actor, or returns false otherwise
a.isEnemy() // Returns true if the subject's an enemy, or returns false otherwise
a.addNewState(stateId) // Adds state with id stateId to the subject
// Rare
a.buffLength() // Returns the number of params having buffs/debuffs for the subject
a.buff(paramId) // Returns the buff level of param with id paramId for the subject(negative means debuff)
a.elementRate(elementId) // The element rate of element with id elementId for the subject
a.debuffRate(paramId) // The debuff rate of param with id paramId for the subject
a.stateRate(stateId) // The state rate of state with id stateId fot the subject
a.attackSpeed() // The speed of attack for the subject
a.attackTimesAdd() // The attack times add for the subject
a.isSkillTypeSealed(stypeId) // Returns true if the skill type with id stypeId is sealed for the subject, or returns false otherwise
a.isSkillSealed(skillId) // Returns true if the skill with id skillId is sealed for the subject, or returns false otherwise
a.speed() // The speed of the subject
If you wish to learn more, you may want to understand rpg_objects.js(Game_BattlerBase, Game_Battler, Game_Actor, Game_Enemy should be your main focus) 🙂
I made a simple script that does this. I might not be near my computer to attach it until tonight or tomorrow, though.
Original thread: https://forums.rpgmakerweb.com/threads/damage-cant-go-to-zero.62633/