I used this formula for actor 2 "b.actorId() == 2 ? -10 : 50" but instead of causing damage it just doesn't heal but it does heal everyone else which is good but it should cause damage for actor 2. Maybe I didn't input the formula right.
Damage Formulas 101
● ARCHIVED · READ-ONLY
-
-
@Sunlo Why didn't you post this in the thread you made where you asked about this and I suggested that formula? It always makes more sense to keep a topic in one place.
I missed that evalDamageFormula() prevents healing from going into negative just like damage.
So to do what you want, you'd need to use a plugin like VisuStella Battle Core and change the damage value after it's calculated. -
this was a very useful tutorial.
-
I totally understood all that, *sweats as he tries to be convincing.* Heh I read all those formula's though, very in depth. I imagine it was aimed at MZ but I'm currently on VX Ace, I have MZ but have not started working on that yet. I was just ghosting about here to see if someone was having the same issue, but this is much more advanced then what I'm trying to figure out.
I was just trying to see if there was a means within the RPG Maker VX itself to make it to where no matter how weak an enemy is, they always do 1 damage at the least. If that was covered in all that....*shudders* math, up there then It clearly went over my head, not hard considering I'm a rodent...ha! -
I imagine it was aimed at MZ
From the first post, "Math.max(numbers) - returns a maximum number from provided numbers."I was just trying to see if there was a means within the RPG Maker VX itself to make it to where no matter how weak an enemy is, they always do 1 damage at the least.
Googling the Ruby version of that:
Code:[your formula, 1].max -
Where would I put the Math.round(number) in this formula so it stops showing decimals?
a.gainHp(- a.hp / 4); a.hp / 5
The skill sacrifices the user's HP to restore a smaller amount to the target. -
around any bit of math that can produce a decimal, but isnt a part of the final damage/heal as that is already rounded
a.gainHp(-Math.round(a.hp / 4)); a.hp / 5 -
I think you need to encase everything within math.round unless you using Visustellaaround any bit of math that can produce a decimal, but isnt a part of the final damage/heal as that is already rounded
a.gainHp(-Math.round(a.hp / 4)); a.hp / 5 -
Thank you, it seems to work fine as is, though :D (I'm not yet using visustella)I think you need to encase everything within math.round unless you using Visustella
-
by default, the last step the engine takes before completing damage a calc is to round the result. its why you can feed a decimal directly into the formula box, and if its a part of the final damage calc, it doesnt give a decimal ingame, but if you put any code before it that to do anything else, you have to round it manuallyI think you need to encase everything within math.round unless you using Visustella
Default Damage StepsCode:Game_Action.prototype.makeDamageValue = function(target, critical) { var item = this.item(); var baseValue = this.evalDamageFormula(target); var value = baseValue * this.calcElementRate(target); if (this.isPhysical()) { value *= target.pdr; } if (this.isMagical()) { value *= target.mdr; } if (baseValue < 0) { value *= target.rec; } if (critical) { value = this.applyCritical(value); } value = this.applyVariance(value, item.damage.variance); value = this.applyGuard(value, target); value = Math.round(value); return value; }; -
My other question is how could I take this
a.gainHp(-Math.round(a.hp)); a.hp
and make it damage the enemy?
It's a self-sacrifice skill but the current formula accounts for damage after the user loses their HP, resulting in '0' damage to the enemy.
Sorry, trying to do as much as I can skill-wise w/o using plugins. -
Try storing a.hp into a temporary variableMy other question is how could I take this
a.gainHp(-Math.round(a.hp)); a.hp
and make it damage the enemy?
It's a self-sacrifice skill but the current formula accounts for damage after the user loses their HP, resulting in '0' damage to the enemy.
Sorry, trying to do as much as I can skill-wise w/o using plugins.
var dmg = a.hp; a.gainHp(-Math.round(a.hp)); dmg -
Yes! perfect! Thanks so much! :DTry storing a.hp into a temporary variable
var dmg = a.hp; a.gainHp(-Math.round(a.hp)); dmg
When I use this in battle, the user is not able to be revived using items or skills, despite it showing the normal Death state after user?Try storing a.hp into a temporary variable
var dmg = a.hp; a.gainHp(-Math.round(a.hp)); dmg
I also created an MP-sacrifice skill that seems to work fine? -
I tested it on my blank project. I cannot replicate this bug.When I use this in battle, the user is not able to be revived using items or skills, despite it showing the normal Death state after user?
I also created an MP-sacrifice skill that seems to work fine? -
I just figured it out. I had the healing skills/items set to 'ally' and not 'Ally (dead)'I tested it on my blank project. I cannot replicate this bug.
-
Is there a way to make an attack use Damage HP when against a certain actor but use Damage MP against another one?
-
The problem with that is the damage type is determined by what you select in the database.Is there a way to make an attack use Damage HP when against a certain actor but use Damage MP against another one?
So you could set it to HP Damage and use script calls in the formula to take MP instead, but there are two issues:
1 - You'd see a 0 damage popup for the HP
2 - You should not put script calls that change anything into the damage formula, because they'll be executed when the game evaluates that skill during enemy turns or Auto Battling.
I think you'd be better off giving it no damage type in the database, then using Yanfly's Action Sequence to program out the skill and figure out how to code damage execution inside of that.
And yes, that is as complicated as it sounds.
You could also try putting a Yanfly Auto Passive State on the target that uses Buffs and States Core notetags to convert the HP damage into MP damage and try to deactivate the HP popup. -
Since the character I want to use this on is a character that has 0 HP but receives damage on MP, the Buffs and States Core made the trick. Just added a Invisible Status with a Respond Effect that gains the negative value of the damage.The problem with that is the damage type is determined by what you select in the database.
So you could set it to HP Damage and use script calls in the formula to take MP instead, but there are two issues:
1 - You'd see a 0 damage popup for the HP
2 - You should not put script calls that change anything into the damage formula, because they'll be executed when the game evaluates that skill during enemy turns or Auto Battling.
I think you'd be better off giving it no damage type in the database, then using Yanfly's Action Sequence to program out the skill and figure out how to code damage execution inside of that.
And yes, that is as complicated as it sounds.
You could also try putting a Yanfly Auto Passive State on the target that uses Buffs and States Core notetags to convert the HP damage into MP damage and try to deactivate the HP popup. -
Is V[10] the variable for the damage calculated?
-
Sorry, what are you talking about?Is V[10] the variable for the damage calculated?
There is no V in the damage formula, only v. And v[10] is game variable ID 10.