State count in damage

As I mentioned before, it looks like your damage formula is backwards. Whatever you say last is what it will use for damage, so right now it's going to use the number of turns the attacker has of state 36.

Do you really want it to be hitting for, like, 4 damage? If so, what's the point of the first part, the stateTurns * 1000? It seems like you want that to be second, so that's the damage.

For the notetags, you should delete all of the things you've been told isn't right.
- stateTurns(36) += 3 can't work because that returns a value, it doesn't let you set one
- addStateTurns() doesn't exist

As caethyril told you in post #2, ._stateTurns[36] is the correct syntax. So user._stateTurns[36]+=3 should work correctly. However, I would expect it to not work while you have incorrect code in the same notetag.

So delete everything else and see if that works correctly.
well the idea it was realy hit first them buff after, it take in account that the user would have to use another skill that would give this state before using this skill. But now that i cleared the notebox its worked! Thx a lot!
well the idea it was realy hit first them buff after
There's no such thing as ordering like that if you put it in the damage formula. The only thing the damage formula cares about is the last statement is what it uses for the damage. Anything else you do that isn't damage has to happen before that.

You may want to read up on some of the info here:
There's no such thing as ordering like that if you put it in the damage formula. The only thing the damage formula cares about is the last statement is what it uses for the damage. Anything else you do that isn't damage has to happen before that.

You may want to read up on some of the info here:
thats rly strange, the damage and the duration increase was both working, but i will read the damage 101 post
I know how damage formulae work. What you posted above is probably not a valid formula because I doubt the result of the turns + 3 is how much you want to hit the enemy for.

Feel free to tag me when you post a screenshot of your entire skill, and I'll try to help you.
1673896426089.png


My last obstacle is to make a state that reduces the damage suffered according to the amount of turns in another state. I used <Custom React Effect> and it worked when I used the command line "value -=200;" Which means the reaction works. However, when I try to assign the value to the number of turns in the "36" state, the code simply does not work. I tried writing "this._stateTurns[36];" and tried "this.stateTurns(36);"
However, when I try to assign the value to the number of turns in the "36" state, the code simply does not work. I tried writing "this._stateTurns[36];" and tried "this.stateTurns(36);"
If you're interested in these kinds of advanced effects that require scripting, you may want to do some JavaScript tutorials. I like this one, but there are tons you can find by Googling it (or getting books or whatever). I'm not sure how much is confusion and how much is you copy/pasting lines you don't understand, but you're producing very strange things 😛

this does not refer to the state on the battler. You need to use user and target (incidentally, this was mentioned before in posts #2 and #6).

There's really no point in declaring a variable that's only used one time and isn't manipulated at all. There's also no point in using Math.ceil() when you're multiplying an integer by an integer, the result will always be another integer.

Your notetag will work if you do this:
Code:
if (this.isHpEffect() && value>0)
    value -= target._stateTurns[36]*100;
If you're interested in these kinds of advanced effects that require scripting, you may want to do some JavaScript tutorials. I like this one, but there are tons you can find by Googling it (or getting books or whatever). I'm not sure how much is confusion and how much is you copy/pasting lines you don't understand, but you're producing very strange things 😛
wow thx a lot, i searched for someting like that. i founded only the
this does not refer to the state on the battler. You need to use user and target (incidentally, this was mentioned before in posts #2 and #6).
Oh god! I used 'target' and worked!
There's really no point in declaring a variable that's only used one time and isn't manipulated at all. There's also no point in using Math.ceil() when you're multiplying an integer by an integer, the result will always be another integer.
Yea, I just put it this way to be easier to see the damage changing in the fight. But in final code will be more a percent change in damage than a flat multiplication. so i keeped the "ceil" to remember to use it futhermore.
I know how damage formulae work. What you posted above is probably not a valid formula because I doubt the result of the turns + 3 is how much you want to hit the enemy for.

Feel free to tag me when you post a screenshot of your entire skill, and I'll try to help you.
Soo i need to reopen this thread, since i found myself creating a auto passive that use this mechanic, not just a single skill:

My Idea is to use yanfly's passive,buff And states, to do something like this:

Before damage: check How many stacks of the state 33 the enemy has, then sum this value to the user attack state.

Damage phase: the chosen skill Go as normal.

After damage: reduce the user attack to its original state.

I dont have a screen shot right now, cuz i dont even know How to start to do that, i just gess that o Will have to do a lunatic code
I dont have a screen shot right now, cuz i dont even know How to start to do that
You could Google "take screenshot." It's fewer keystrokes than writing that sentence and you wouldn't have to wait for someone here to respond 😉

If you're on Windows, you press the Print Screen (PrtSc) button. Open up Paint (or any other image editor) and paste.

Save the file as something small like a jpg and press the Attach Files button while writing a post here.

If you have Windows 11 it's even easier because of the included snip program. Press Shift+Windows+S to start that, then after you select it the pop-up notification lets you save the file directly from there. No need to open a second program.
You could Google "take screenshot." It's fewer keystrokes than writing that sentence and you wouldn't have to wait for someone here to respond 😉

If you're on Windows, you press the Print Screen (PrtSc) button. Open up Paint (or any other image editor) and paste.

Save the file as something small like a jpg and press the Attach Files button while writing a post here.

If you have Windows 11 it's even easier because of the included snip program. Press Shift+Windows+S to start that, then after you select it the pop-up notification lets you save the file directly from there. No need to open a second program.
I was talking about the code, not the screen shot 😛 i dont even know How start to do It. I dont know How to call some event exactly before the damage and another after the damage.

I alread Saw notebox codes that call some action at turn start or action start and those ends, but i cant find a Guide to that
Personally, I don't care for actually manipulating the actor's parameters back and forth like that - it's messing with the engine's mechanics and introduces some room for error.

I would instead recommend just putting it into the damage formula of your skill. Wherever you reference a.atk you can copy and paste:
Code:
(a.atk + a.isStateAffected(X) ? b.getStateCounter(33) : 0)

where X is the ID of your passive state.
It might take you a minute to paste that into all of your skills that actors get, but then you don't have to worry about any interactions between other ATK-boosting gear or buffs or anything.

If you want those interactions, and you really want to do it modularly in your state, then give the passive state these notetags:
Code:
<Custom Initiate Effect>
user.atkBoost=target.getStateCounter(33);
user.addParam(2, user.atkBoost);
</Custom Initiate Effect>

<Custom Conclude Effect>
user.addParam(2, -user.atkBoost);
delete user.atkBoost;
</Custom Conclude Effect>
Personally, I don't care for actually manipulating the actor's parameters back and forth like that - it's messing with the engine's mechanics and introduces some room for error.

I would instead recommend just putting it into the damage formula of your skill. Wherever you reference a.atk you can copy and paste:
Code:
(a.atk + a.isStateAffected(X) ? b.getStateCounter(33) : 0)

where X is the ID of your passive state.
It might take you a minute to paste that into all of your skills that actors get, but then you don't have to worry about any interactions between other ATK-boosting gear or buffs or anything.

If you want those interactions, and you really want to do it modularly in your state, then give the passive state these notetags:
Code:
<Custom Initiate Effect>
user.atkBoost=target.getStateCounter(33);
user.addParam(2, user.atkBoost);
</Custom Initiate Effect>

<Custom Conclude Effect>
user.addParam(2, -user.atkBoost);
delete user.atkBoost;
</Custom Conclude Effect>
This "custom initiate effect" Will happen at turn start or when the actor get the status effect?

And its really important do this in that modular way because more than one actor Will may have this passive, and this Will happen with others status effect too
This "custom initiate effect" Will happen at turn start or when the actor get the status effect?
The details of the notetags and when they execute their code is described in the plugin help file.
The details of the notetags and when they execute their code is described in the plugin help file.
Which help file? i cant find anything like that in the in RMV folders. My main question is to understand the possible phases of the turn and how call codes on them. I cant find a place to learn that
Which help file? i cant find anything like that in the in RMV folders.
The plugin help file. The plugin doesn't have anything to do with RPG Maker MV, you downloaded it externally and installed it.

You can see the help file by going into the plugin manager in MV and clicking on the plugin, the entire left side of the window shows it.

You can also look it up on the author's Web site.
The plugin help file. The plugin doesn't have anything to do with RPG Maker MV, you downloaded it externally and installed it.

You can see the help file by going into the plugin manager in MV and clicking on the plugin, the entire left side of the window shows it.

You can also look it up on the author's Web site.
this is it? http://www.yanfly.moe/wiki/Category:Lunatic_Mode_(MV)
I think I understand now: this lunatic mode link represents all YEP plugin commands, but each one already shows these commands in a less organized and detailed way. I was mixing commands from different plugins in my mind, like the battle ones with the skills, now everything is much clearer. Thank you very much for the help

Original thread: https://forums.rpgmakerweb.com/threads/state-count-in-damage.154102/