So I actually have a state that makes the player under it uberpowerfull for the duration , but I want after the state is removed to create a side a effect on the player - have him fell in a different state. Is this by any way possible?
Any way of adding secondary States when a state worns off?
RPG Maker VXAce SupportI think Yanfly's Lunatic States is exactly what you need:
https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-states/
https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-states/
Tsukihime also has a script for successive states, but I don't have the link ready
I can't make Yanfly's script working....
Yanfly forgot to add an eval line, so the lunatic states will not work without some side coding on your part (in my opinion the script is useless without the add-ons due to the missing eval line as all it does is have the code you pass fall through and do nothing). You will either need to add one of the add-ons and code it in, or add the following line to the code:
First, find the line that says common effects, leave. Its line 144 on mine, but I have edited a couple of lines, so look near that. Once you find it, add this line below the line that says while /Common Leave/i
eval(state.leave_effects[1]) rescue ""
What will happen is every time a state is removed, it will eval the 1st line of anything you passed under custom conditions, and the rescue part prevents a crash if that line doesn't exist.
To use it (once these changes are made):
Add this notetag:
<leave effect>
add_state(x)
</leave_effect>
Replace x with the state id of the new state you want added. Want it to be a doom type effect? Use add_state(1).
First, find the line that says common effects, leave. Its line 144 on mine, but I have edited a couple of lines, so look near that. Once you find it, add this line below the line that says while /Common Leave/i
eval(state.leave_effects[1]) rescue ""
What will happen is every time a state is removed, it will eval the 1st line of anything you passed under custom conditions, and the rescue part prevents a crash if that line doesn't exist.
To use it (once these changes are made):
Add this notetag:
<leave effect>
add_state(x)
</leave_effect>
Replace x with the state id of the new state you want added. Want it to be a doom type effect? Use add_state(1).
And if I want it in erase just do this then ? :
eval(state.erase_effects[1]) rescue ""
and notag :
<erase effect>
add_state(x)
<erase effect>
eval(state.erase_effects[1]) rescue ""
and notag :
<erase effect>
add_state(x)
<erase effect>
No, he didn't forgot to add this, the script just isn't supposed to do anything on its own. What you should do is adding a case like this:
And put your notetag like this:
Code:
when /ADD STATE/i user.add_state(x)
Code:
<leave effect>add state</leave effect>
@Larva: I find that is not explained well by Yanfly honestly, as there are many complaints about it on the message board. Plus, I feel Yanfly has advertised it as allowing custom conditions, but if you don't make it so the custom tag works, that screenshot showing it then should not exist then. As it is, it misleads many about how it works. That's why I advocate adding the eval line, then it works for the non scripters too, so they don't have to add the custom state into the code every time they want a new custom condition.
Plus, your solution locks him into always adding the same state every time. What if the OP wants to change it?
@Josephkhland: Erase effect is when the state is removed by an item or skill before its time is up, leave effect is when it leaves due to time running out. Pick whichever fits your situation.
Plus, your solution locks him into always adding the same state every time. What if the OP wants to change it?
@Josephkhland: Erase effect is when the state is removed by an item or skill before its time is up, leave effect is when it leaves due to time running out. Pick whichever fits your situation.
I'm not here to argue if it makes sense this way, i just wanted to clarify how the script is meant to work ^^. Also, i wouldn't call an eval line "works for non-scripters", since you have to add the actual code anyway, it's just in a different place 😀
True, and I will agree it is listed as an advanced script. That is probably why too.
You think there is a way to edit your version to work for any state? I'm bad at notetags, and maybe we should give the OP a choice of options? Plus I'm curious to see what it looks like myself (and I do hear eval lines can slow a game down, probably not significant unless one uses an ABS).
You think there is a way to edit your version to work for any state? I'm bad at notetags, and maybe we should give the OP a choice of options? Plus I'm curious to see what it looks like myself (and I do hear eval lines can slow a game down, probably not significant unless one uses an ABS).
Can't test, but this should do it:
Code:
when /ADD STATE (\d+)/i user.add_state($i)
Code:
<leave effect>add state 1</leave effect>
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/any-way-of-adding-secondary-states-when-a-state-worns-off.40633/