RPG-Maker MV counter for states should be unaffected the same turn the state is applied

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Something that bothers me extremely is when a state is applied the turn counter already counts down the turn the state was applied. So I have to make a lot of states last 2 turns instead of 1 for example, because within the turn the state was applied t's already gone.

So is there any way or any plug-in that changes that behavior, The best would be something I can activate and deactivate for each state independently that would spare me some effort.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
Why is it worth trying to modify the engine instead of simply accounting for it in your states the way you already are?

You can use various Yanfly plugins to modify the duration of states. Yanfly's Battle Engine Core also adds the option of using notetags to have your typed number of turns/actions be counted at the beginning of that turn instead of the end, which sounds like what you want.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Oh thanks for the advice i looked at yanflys buffs and states core but couldn't find anything. Didn't already know the Battle Engine Core had exactly what I wanted.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,279
Reaction score
9,703
First Language
German
Primarily Uses
RMMV
So I have to make a lot of states last 2 turns instead of 1 for example, because within the turn the state was applied t's already gone.
the reason for this is that the original engine takes the skill speed as a viable option, and with that the duration 1 turn gains a lot of versatility.

the action order is battler.agi plus skill.speed plus random percentage, sorted highest to lowest.
that means a skill with a high speed is used earlier in the battleturn, making it ideal for skills that protect only the same turn but not the next turn.

too many developer choose to ignore skill speed for simpler fights, but if you do not ignore it then it becomes a valid option to use states (especially protection states) that only last the current turn.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Why is it worth trying to modify the engine instead of simply accounting for it in your states the way you already are?

You can use various Yanfly plugins to modify the duration of states. Yanfly's Battle Engine Core also adds the option of using notetags to have your typed number of turns/actions be counted at the beginning of that turn instead of the end, which sounds like what you want.
Oh it looks like I confused something if I use Yanflys Notetags "Turn Start" or "Action Start" the state vanishes right after the start of the next turn. What I actually would like is seing the state vanish after the end of the next turn is applied. D:
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
Oh thanks for the advice i looked at yanflys buffs and states core but couldn't find anything.
There are notetags to run code when a state gets applied. There are examples given that adjust things with counters, but the same tags could be used to modify the duration of the state.

Oh it looks like I confused something if I use Yanflys Notetags "Turn Start" or "Action Start" the state vanishes right after the start of the next turn. What I actually would like is seing the state vanish after the end of the next turn is applied. D:
Then you would use the default way MV works and enter a duration of 2 turns. 1 for the turn the state gets applied in and 1 for the end of the next turn.

The problem with what you're asking for is you would make the turn counters meaningless to the player because they wouldn't know whether 1 means 1 or 2 or...whatever. If the numbers don't mean a consistent thing, they're pointless.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
There are notetags to run code when a state gets applied. There are examples given that adjust things with counters, but the same tags could be used to modify the duration of the state.


Then you would use the default way MV works and enter a duration of 2 turns. 1 for the turn the state gets applied in and 1 for the end of the next turn.

The problem with what you're asking for is you would make the turn counters meaningless to the player because they wouldn't know whether 1 means 1 or 2 or...whatever. If the numbers don't mean a consistent thing, they're pointless.

I know I guess my dilemma needs some context.

I have 3 states, these 3 states prevent that you become healed from healing items. Each of them them should only last 1 turn.



- State 1
- State 2
- State 3

- State 1 can be applied manually directly
- State 2 can be applied manually directly
- State 3 can be applied manually directly

- When State 1 ends, well the state is gone and the enemy or actor is stateless
- When State 2 ends, State 1 becomes automatically applied, after this -> see "State 1" rules
- When State 3 ends, State 2 becomes automatically applied, after this -> see "State 2" rules

So my dilemma here is, when I apply a state manually - 1 turn bascially is already gone for nothing if I don't see it to "2" turns.
So for State 1 there is no problem with that. But the problem occurs when State 2 or 3 are switching to the lower number, because then the turn "starts" at a different point, because the switch happend not thorugh an action but through the vanishing of the last state
And so State 2 & 3 who are also set to 2 turns (cause they be applied also manually) will take 1 turn for the first state, but 2 full rounds for the following states.

If you now ask, why I don't just use 3 different states with different durations when they all do the same anyway, well some unique visual effects are tied to them it would break completely with my streamlined process. D:

The only solutions that comes to my mind is creating different states for ticks and for the first state you manually aplly to an enemy. So the applied one switches to the "tick" ones, but that would be a hassle, cause no I have to check for twice as much states. xd
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
the problem occurs when State 2 or 3 are switching to the lower number, because then the turn "starts" at a different point
Edit: I understand what you're saying. You should use Yanfly notetags in the skills that can apply States 2 or 1 manually to change the duration of the state after adding it.

Alternately, you can make a second copy of State 2 that has a duration of 2 turns, all the rest of the settings are the same, and that's what the skill that can manually apply it uses.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Edit: I understand what you're saying. You should use Yanfly notetags in the skills that can apply States 2 or 1 manually to change the duration of the state after adding it.

Alternately, you can make a second copy of State 2 that has a duration of 2 turns, all the rest of the settings are the same, and that's what the skill that can manually apply it uses.

There is a notetag that allows me to inflict a state and decide manually for how many turns the state lasts, independently from what the original turn count of that skill would be?

That would be the perfect solution, do you know which commands I could for this? I wasn't lucky so far in the Buffs & States Core & Battle Engine Core.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
1,012
Reaction score
654
First Language
English
Primarily Uses
RMMV
There is a notetag that allows me to inflict a state and decide manually for how many turns the state lasts, independently from what the original turn count of that skill would be?

That would be the perfect solution, do you know which commands I could for this? I wasn't lucky so far in the Buffs & States Core & Battle Engine Core.
There is no notetag to do that, but you can use the custom apply effect, or remove effect note tags to change the numbers of turns a state is in effect for:

target._stateTurns[3] This is how many turns state id 3 has left on the target. You can add to or subtract from that number to make it last an extra turn, or less turns than default.

In the various different battle systems yanfly made, turns were counted on a per actor basis, so a state that was applied to all allies, with a duration of 1 turn, would disappear immediately on the user of the skill, but would last until the end of every other allies next action. Meaning to make it give the user a turn of the state without giving two turns of it to all of his allies, you'd have to fidget around with the stateTurns of the state as it was added to increase the number of turns it lasted on only the user of the skill.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
That would be the perfect solution, do you know which commands I could for this?
ramza gave you the code you'd use, although I think rather than going in a state notetag you'd want to put it in the skill, so after it resolves it adjusts the duration.

But honestly, if you don't know any JavaScript, it would be easier to use my other suggestion and just create a second State 2 and State 1 that you apply with skills.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Ok this sounds plausible so far, but the question is. Where can I inject that javascript code for items?
Yes it's not per se a skill it's an consumable item. Dunno this makes a huge difference.

if i'm doing an script call in an common event like that: target._stateTurns[66]===target._stateTurns[66]+3 the game crashes with an script call error. D:

(just an example to test if I can bring it to work)
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
1,012
Reaction score
654
First Language
English
Primarily Uses
RMMV
An item can use the same note tags as a skill, so you can use the <After Eval> for that.

The code you're using would give you an error either way though, because what you've written is a conditional statement, you only ant one '=' to change the value of something, but you could also use '+= 3' to add 3 to the current value.
target._stateTurns[66]+=3
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Alright that works splendidly although... well I admit I have still one single problem. D:
So it looks like adjusting the turn numbers happens every time the item is used, this is a problem because they effect shouldn't be reapplyable. So I need to to check if the target the item is used (not the actor per se) already has that effect otherwise don't increase turns. But I only know how to refer to certain actors and gametroop members, is there also a javascript variable that refers to the target the item is used on?
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Ok I believe I figured something out so far my notetag for the item looks like that:

<Actor or Enemy Select>

<max item: 9>

<target action>
if target.isStateAffected(66)===false
action effect
<After Eval>
target._stateTurns[66]=2
</After Eval>
else
action effect
end
</target action>

Still although the user is affected with the state, the counter reapplies the status although I have the

<Reapply Ignore Turns> tag under state 66.

Whats wrong here? Can it be that the <After Eval> tag ignores the if statement? Unbelivable how complicated such a small thing can be. D:
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
Whats wrong here?
Erm...quite a bit.

Have you read the instructions for these plugins you're using commands from? Don't just go off of fragments of words that people on forums say, make sure you know what you're doing :wink:

1 - You can't put notetags inside of notetags. Putting the After Eval inside of an action sequence section doesn't do anything.

2 - That's in the wrong place, anyway, because an action sequence is what runs during the skill. After Eval, by the definition in the instructions, runs afterward. That's like telling the engine to take a bite of its dessert during the salad course - it doesn't exist yet.

3 - What is the point of the code in your action sequence? You're saying "if the target has state 22, action effect, else action effect." That doesn't achieve anything.

I don't see why you need an action sequence for this skill at all, especially if the only command in it is "action effect" - that happens automatically when you use the skill normally. But, regardless, the After Eval has nothing to do with action sequences.

1 - I maintain this whole process would've been much easier if you just copied the state. Say state 66 has a duration of 1 turn and it's what your NoHealState_Level3 turns into. Make state 67, or whatever, be exactly the same, but with a duration of 2 turns, and it's what gets applied when you put it on directly from a skill.

2 - If there's some reason you're really opposed to that, and you want to mess with notetags, what you're trying to achieve is say "If the target didn't have this state before I hit him, so he got it from this skill, make the duration be 2."

Code:
<Pre-Damage Eval>
target.hasState=target.isStateAffected(22) ? true : false;
</Pre-Damage Eval>

<After Eval>
if (!target.hasState)
    target._stateTurns[66]++;
</After Eval>

And those notetags go outside of any others.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Erm...quite a bit.

Have you read the instructions for these plugins you're using commands from? Don't just go off of fragments of words that people on forums say, make sure you know what you're doing :wink:

1 - You can't put notetags inside of notetags. Putting the After Eval inside of an action sequence section doesn't do anything.

2 - That's in the wrong place, anyway, because an action sequence is what runs during the skill. After Eval, by the definition in the instructions, runs afterward. That's like telling the engine to take a bite of its dessert during the salad course - it doesn't exist yet.

3 - What is the point of the code in your action sequence? You're saying "if the target has state 22, action effect, else action effect." That doesn't achieve anything.

I don't see why you need an action sequence for this skill at all, especially if the only command in it is "action effect" - that happens automatically when you use the skill normally. But, regardless, the After Eval has nothing to do with action sequences.

1 - I maintain this whole process would've been much easier if you just copied the state. Say state 66 has a duration of 1 turn and it's what your NoHealState_Level3 turns into. Make state 67, or whatever, be exactly the same, but with a duration of 2 turns, and it's what gets applied when you put it on directly from a skill.

2 - If there's some reason you're really opposed to that, and you want to mess with notetags, what you're trying to achieve is say "If the target didn't have this state before I hit him, so he got it from this skill, make the duration be 2."

Code:
<Pre-Damage Eval>
target.hasState=target.isStateAffected(22) ? true : false;
</Pre-Damage Eval>

<After Eval>
if (!target.hasState)
    target._stateTurns[66]++;
</After Eval>

And those notetags go outside of any others.

My problem with creating a second state is that I don't want to double the state count, that would make it more complicated checking for all of them. However what you recommended to me works finely. Took me some time to learn this short notation with the "?" haha^^"
Sry i'm not that bright yet handling notetags so yeah nesting them is impossible so much is clear now.

What I still struggle to understand is when am I allowed to check javascript code in yanflys notetag and when not.

I still have one last problem (yeah pretty demanding I know, xd)

So there is an combination of action sequences and damage evaluations

<setup action>
display action
if(target.isEnemy())
$gameSwitches.setValue(273,true)
</setup action>


<target action>
common event: 60
action effect
</target action>

So what is very important to me is that the Switch 273 is set BEFORE the common event 60 takes place. However it doesn't seem to work.
I also placed

if(target.isEnemy())
$gameSwitches.setValue(273,true)

In an <Before Eval> Notetag, but it looks like this takes place after an target action. Unfortunelately the Common Event 60 must take place right before the target action. So I suppose <Before Eval> is too late and on Action Sequence Tags Javascript Code doesn't work anyway? If that's true, is there ANY other place I could check for if the target is an enemy for setting the switch true right in time before the common event can take place. xd

After this I won't bother you furthermore promise.

...

at least not on this subject. xD
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,533
Reaction score
2,897
First Language
English
Primarily Uses
RMMV
What I still struggle to understand is when am I allowed to check javascript code in yanflys notetag and when not.
1 - Inside a conditional (if/else if)

2 - After an eval: command.

That's it. Everything else must be action sequence commands with the syntax described in the instructions.

Your syntax above is wrong because you don't have eval: in front of the game switch function, and you don't end the if.

Again, I know it can be daunting when you first look at it, but I suggest you read through the instructions for Action Sequences again. Even if you're just looking up each command as you use it, the section for "if" shows the correct syntax.
 

Klunky2

Veteran
Veteran
Joined
Jul 2, 2017
Messages
139
Reaction score
12
First Language
german
Primarily Uses
RMMV
Aw my gawd, you're my savior Magus! With "Eval" I meant these "Before Eval", "Pre-Damage Eval" tags and such stuff but I didn't know about the "eval:" statement. This is PRETTY powerful. I worked a lot with action sequences but still was ignorant to that. Thanks for notifying me. Now i'm definitely done and satisfied with my sequence. If my game is done I will definitely mention you in the credits. (unless you don't want because the game is "cringe". xD)

Thanks again!
 
Last edited:

Latest Threads

Latest Profile Posts

So I finally played Persona 4 to see what it's all about. I'm like wait...what the...this is JOJO!
Map025.png

The second settlement you'll visit in my newest game. The small village of Teytal.
sketch 4 an opening cinematic in my gameeee >:]
Untitled_Artwork_16.jpg
oh god how do I add pictures on here it keeps saying i need a link <--( suddenly forgot how technology works )
avery wip.png

"i have to work in like 5 hours ... let's start the main character's face set"
--me, an adult for the past 20 years

Forum statistics

Threads
123,163
Messages
1,154,512
Members
161,520
Latest member
wazazawa
Top