Attack + Buff/Debuff

EDIT: This Post examples has been edited from state to buff/debuff seeing as that is my actual issue.

Hi there, I been having a problem since I started making skills. And that is that I am not sure how to realize most of my ideas and I thought they were relatively simple.

I have a lot of attack ideas where the character Deals Damage and get a low percentage chance to also get a buff or add a debuff.

Example let us say I have an attack called "Magic Arrow of Defense Burden" It deals a certain amount of damage based on my damage formula. And after that there is a 30% chance it will debuff the targets Defense.

As far as I can tell using the Add Effect options leaves me with an All or Nothing situation. Which is bad for balancing. If my "Magic Arrow of Defense Burden" both gets the damage and the 100% debuff and it suddenly becomes extremely powerful. And not giving the it the buff at all hampers my ability to craft unique skills while also being a damper on the flavor behind "Magic Arrow of Defense Burden)

I been looking at forcing an action using Common Events and the Trait system. But this makes it impossible for me to make sure the target and caster remain the same.

Example, if I have 4 Battles. A, B, C and D and there are 3 Enemies E, F and G.

A attacks with "Magic Arrow of Defense Burden" and hits F. Now I want A to be the one to inflict the burn (Still at a 30% chance, but for sake of argument lets say it lands)

Now because of how the common event works it will cast from B because B happened to be a different Actor who also knows the "Flaming Swords" Skill and I picked him as the actor for the common event. This doesnt make sense and is even worse if B wasn't in the party.

Alternately I could set the common event to E1?. Since there is always an "Enemy 1" and then make the debuff inflict on self. This also fails as A just used "Arrow of Defense Burden" on F and E is the one who is in the position of E1?

So what happens now? Well A Casts Arrow of Defense Burden, Deals Damage to F and now E being debuffed. This also doesnt make sense.

Anyone who got any good suggestions?
I am not quite sure i understand the problem.

You can just put the chance to trigger the burn to 30% right?

dd.png
I am not quite sure i understand the problem.

You can just put the chance to trigger the burn to 30% right?

View attachment 173360

That doesn't look like my Interface. You wouldn't happen to be using MZ? Because this is the MV part of the Forum. I am glad to see they fix this issue going forward, but it doesn't help me in my project.

Edit: My bad you are right I can do that with states. (I was assuming States and Buffs/Debuffs was applied identically) I will rectify this
The screenshot was from MV.

You may be put off because I am on dark mode.

Even if it was MZ, it works exactly the same on both MV and MZ.
The screenshot was from MV.

You may be put off because I am on dark mode.

Even if it was MZ, it works exactly the same on both MV and MZ.

MV has a Dark mode? I need to find that, Eye restrain can be such an issue

I dunno if you saw the edit, but I apologies because I was wrong, I assumed States and Buff/Debuffs was handled similarily in the Effects part of the Skills. They aren't. Which while it makes me realizse I have a lot more options to work with. I still can't put Buffs/Debuffs at percentages as a secondary effect. Again I am sorry for my mistake
No problem, glad to help.

You can change between modes here:

mm.png
No problem, glad to help.

You can change between modes here:

View attachment 173369

Thank you so much! This is completely off topic. But finding Dark Mode is gonna do wonders for my late hours working on my game!
Responding to your new problem concerning buff / debuffs, you can do this with a little
custom damage formula magic.

Based on your " Magic Arrow of Defense Burden " Skill, I whipped this up for you:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); X} else {X}

Replace both X with the damage formula for your skill (like a.atk * 2 - b.def)
This would look like this:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); a.atk * 2 - b.def} else {a.atk * 2 - b.def}

You can copy paste the code above into the damage formula of your skill and it should work like you want to.

Here is the template if you want to change some more stuff:
Spoiler: Template
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}

C = Chance to apply the debuff (replace with a whole number like 30 for 30%)
D = Duration of the debuff (replace with a whole number like 3 for 3 turns)
X = The damage formula (replace with any formula of your liking, both X can be different if you wish)
P = Which parameter is debuffed, replace P with these corresponding numbers:

0 - Max HP
1 - Max MP
2 - Attack
3 - Defence
4 - Magic Attack
5 - Magic Defence
6 - Agility
7 - Luck

If you want to apply buffs instead of debuffs, it works exactly the same, except you have to
change this bit:
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}
to this:
if (Math.randomInt(100)+1 <= C) {b.addBuff(P, D); X} else {X}

Just make sure to write a.addBuff or b.addBuff depending on whether the user or the target should get buffed.
Responding to your new problem concerning buff / debuffs, you can do this with a little
custom damage formula magic.

Based on your " Magic Arrow of Defense Burden " Skill, I whipped this up for you:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); X} else {X}

Replace both X with the damage formula for your skill (like a.atk * 2 - b.def)
This would look like this:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); a.atk * 2 - b.def} else {a.atk * 2 - b.def}

You can copy paste the code above into the damage formula of your skill and it should work like you want to.

Here is the template if you want to change some more stuff:
Spoiler: Template
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}

C = Chance to apply the debuff (replace with a whole number like 30 for 30%)
D = Duration of the debuff (replace with a whole number like 3 for 3 turns)
X = The damage formula (replace with any formula of your liking, both X can be different if you wish)
P = Which parameter is debuffed, replace P with these corresponding numbers:

0 - Max HP
1 - Max MP
2 - Attack
3 - Defence
4 - Magic Attack
5 - Magic Defence
6 - Agility
7 - Luck

If you want to apply buffs instead of debuffs, it works exactly the same, except you have to
change this bit:
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}
to this:
if (Math.randomInt(100)+1 <= C) {b.addBuff(P, D); X} else {X}

Just make sure to write a.addBuff or b.addBuff depending on whether the user or the target should get buffed.

This is a godsend! Thank you so much!
Responding to your new problem concerning buff / debuffs, you can do this with a little
custom damage formula magic.

Based on your " Magic Arrow of Defense Burden " Skill, I whipped this up for you:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); X} else {X}

Replace both X with the damage formula for your skill (like a.atk * 2 - b.def)
This would look like this:

if (Math.randomInt(100)+1 <= 30) {b.addDebuff(3, 3); a.atk * 2 - b.def} else {a.atk * 2 - b.def}

You can copy paste the code above into the damage formula of your skill and it should work like you want to.

Here is the template if you want to change some more stuff:
Spoiler: Template
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}

C = Chance to apply the debuff (replace with a whole number like 30 for 30%)
D = Duration of the debuff (replace with a whole number like 3 for 3 turns)
X = The damage formula (replace with any formula of your liking, both X can be different if you wish)
P = Which parameter is debuffed, replace P with these corresponding numbers:

0 - Max HP
1 - Max MP
2 - Attack
3 - Defence
4 - Magic Attack
5 - Magic Defence
6 - Agility
7 - Luck

If you want to apply buffs instead of debuffs, it works exactly the same, except you have to
change this bit:
if (Math.randomInt(100)+1 <= C) {b.addDebuff(P, D); X} else {X}
to this:
if (Math.randomInt(100)+1 <= C) {b.addBuff(P, D); X} else {X}

Just make sure to write a.addBuff or b.addBuff depending on whether the user or the target should get buffed.

I can't seems to make this formula work. When playtesting all I get is 0 damage. :/

EDIT: It currently looks like this in my project

(Math.randomInt(100) +1 <= (30) {b.addDebuff(4, 5); 10* 65* (a.mat / b.mdf) / 25 + 5}; else {10* 65 * (a.mat / b.mdf) / 25 + 5}

{10* 65 * (a.mat / b.mdf) / 25 + 5} is my damage formula
Yeah. It seems some smaller blunders made it into your formula.
Don't worry too much, mistakes like that always happen. The engine is very sensitive to these small details and even one of them will likely break the whole thing.

Let me highlight them for you:


(if) (Math.randomInt(100) +1 <= (30) {b.addDebuff(4, 5); 10* 65* (a.mat / b.mdf) / 25 + 5}; else {10* 65 * (a.mat / b.mdf) / 25 + 5}

You need to have the "if" at the beginning so that the engine recognizes the "if-then-else" structure which is needed to check for the 30% chance of the skill.

Other than that, you just need to remove the highlighted "(" and ";" and you should be good to go.
Try pasting this formula into your skill, I already applied all the fixes:


if (Math.randomInt(100) +1 <= 30) {b.addDebuff(4, 5); 10* 65* (a.mat / b.mdf) / 25 + 5} else {10* 65 * (a.mat / b.mdf) / 25 + 5}
Yeah. It seems some smaller blunders made it into your formula.
Don't worry too much, mistakes like that always happen. The engine is very sensitive to these small details and even one of them will likely break the whole thing.

Let me highlight them for you:


(if) (Math.randomInt(100) +1 <= (30) {b.addDebuff(4, 5); 10* 65* (a.mat / b.mdf) / 25 + 5}; else {10* 65 * (a.mat / b.mdf) / 25 + 5}

You need to have the "if" at the beginning so that the engine recognizes the "if-then-else" structure which is needed to check for the 30% chance of the skill.

Other than that, you just need to remove the highlighted "(" and ";" and you should be good to go.
Try pasting this formula into your skill, I already applied all the fixes:


if (Math.randomInt(100) +1 <= 30) {b.addDebuff(4, 5); 10* 65* (a.mat / b.mdf) / 25 + 5} else {10* 65 * (a.mat / b.mdf) / 25 + 5}

Just tested it and it works perfectly. Thank so much again. I appreciate all of your help very much ^^
If there is any Mods seeing this. I politely request this thread closed due to problem solved.

Original thread: https://forums.rpgmakerweb.com/threads/attack-buff-debuff.131567/