OOOOOOOOOOOOOOOOOOOOOOOOHHH! Handy.
Thank you for a great script! I appreciate your work! I admire that you are working on many specific scripts for specific needs, Tsukihime. Utility scripts are the most under-appreciated things, honestly.
General question: May I kindly ask you to provide more examples for how to use your formula variables? How can I make a conditional state that checks to only apply a state to members of my party (not a specific member, but the whole hero party)? How can I make a conditional state that only applies to the enemy? How can I make a conditional state which only works if switch 001 is on? I'm trying to figure out the code, but, the conditional logic is confusing. Any help would be much appreciated.
Specific question: I'm trying to use a conditional state to determine if the battler that the state will be added to is a party member, and if so, apply x, if not, apply the else y. Your script seems like it will be tremendously powerful and useful for making this happen!
Here is my conditional formula:
<conditional state> if a = p 6 else 30 end </conditional state>Can you spot anything with your experienced eyes that is wrong? In this condition, when I use Sleep with the proper placeholder state in its Effects, against my party or my enemy, state 6 (Sleep) is always determined to be applied, even on enemies. State 30 (enemy-customized version of Sleep state) is never used.
It's my understanding that your Conditional State's formula variable p is equivalent to $game_party. I figure that I am making a mistake here and there is a difference between a global variable and its contents, I am guessing. However, I don't understand how to make conditional checks or what place I should check. If I introduce a p.battle_members?, I still need something to check, right? Even if I try to make more conditional methods for each member of my party, using awkwardly, clumsily and repeatedly "if a = p.battle_members.include?($game_actors[id])", the conditional is ignored and the "if" state (state 6) is always applied. I would prefer something more direct and smoother to use. I've read through resources here on formulae, but I've came up unsuccessfully short, so far. I tried the same formula in a blank project, as well, so I doubt it's a compatibility issue.
What do you think, Tsukihime?
Why not another version that allows caster conditions? 🙂
I mean use the battler that caused the state as part of the conditions... I saw your answer above telling that you didn't add that since this was supposed to be a general purpose script that will work for any state addition... so I was thinking, why not just add another version that supports that?
though of course that is quite a bit harder to do than this if I remember correctly... I was simply curious... 🙂
I'd say it's just more restrictive. This script was intended to allow you to create placeholder states for any sort of state adding purposes.
You would just overwrite the "Add state" effects if you want to include the user.
That would be a completely different script in my view, just because it's more restrictive.
EDIT: well, maybe not overwrite. It would just do a check to see whether the condition is met or not before even adding it.
Hi Hime!
Trying to make a TP like resource using states with this script. I'm trying to have skills add state 67
and if they already have 67 it removes 67 and adds 68
if they already have 68 it removes 68 and adds 69
i can get it to add 68 just fine...its just adding 69 it messes up and adds 67 and 68 instead
here is what i got setup on state 67 and I hope a Wiz like you can see what i messed up
<conditional state>
if a.state?(68) & !a.state?(67)
a.remove_state(68)
69
if a.state?(67) & !a.state?(68)
a.remove_state(67)
68
else
67
end
else
67
end
</conditional state>
can someone tell me if this is alright?
<conditional state>
if a.mhp? =< 30%
a.state (37)
else
</conditional state>
this is supposed to be like a passive skill so whenever actor's hp is less or equal to 30% it will activate state 37 (which is regen) and regen is supposed to cancel state 36 (the state above mentioned), im using NB passive skill's script so (36) will trigger everytime a battle starts
I'm attempting to do something like deadly7h in that I wish to not only use the user's current hp (in the sense that upon taking damage something happens) but also if the enemy takes damage (also in the sense of upon any troop taking damage from the user then something happens)
my current (and incorrect) script is
The number 28 in the scripts is the control state, so long as that state is active ebb and flow can continue to switch as many times as needed.
For "Ebb" (ebb is the state induced when the user deals damage and is represented in the script by the number 27)
<conditional state>
if a.state?(28)
if a.((mhp? > 0) && ( mhp? <= 100))
29
a.remove_state(27)
else
27
end
else
a.remove_state(27)
a.remove_state(29)
end
</conditional state>
For "Flow" (flow is the state that is induced and receiving damage and is referred to as 29. Uses Hamedo's improved counter script to induce the true counter attack state, not sure exactly how to tie that in but the state number for the true counter attack is 33)
<conditional state>
if a.state?(28)
if t.((mhp? > 0) && ( mhp? <= 100))
27
a.remove_state(29)
else
29
end
else
a.remove_state(29)
a.remove_state(27)
end
</conditional state>
Both Ebb and Flow are active until the condition given to cause a switch to the opposite and allow each states effect to take hold until the switch condition is met. Some help would be VASTLY appreciated. Thanks!
The return value of the formula is the ID that will be used.
It would be better to explicitly write out "return" so that it is clear what your logic is.
<conditional state> if a.state?(28) if a.((mhp? > 0) && ( mhp? <= 100)) a.remove_state(27) return 29 else return 27 end else a.remove_state(27) a.remove_state(29) return 0 # to be specific: no state will be added end </conditional state>However, it looks like you are using other scripts in order to apply these states.Depending on how those scripts are written, they might not even call the conditional state logic.
Thanks for the quick reply. I attempted to use the script given. I got an error saying unidentified method 'mhp?' for RPG::state:0x703cc9c
Also, the script Hamedo is just a state that would also be proc'd into from the conditional branch.
Just popping in to say huge thanks for this! 🙂
Hello, the script is awesome! I figured out how to add up to 10 states. In my game there is a shield system. If enemy casts shield on all allies, it gives them state Shield lvl+1 from 1 to 10. But i cant find a working formula to configure a conditional state that removes states one by one. Maybe someone has an idea how to do it?
When player casts skill, I get an error:
Script 'Game_Battler' line 92: TypeError occured.
no implicit conversion from nil to integer.
My not working formula for conditional state looks like that:
(state 100 = Shield level 1; state 109 = Shield level 10)
<conditional state>
if a.state?(109);
a.remove_state(109)
elsif a.state?(108);
a.remove_state(108)
elsif a.state?(107);
a.remove_state(107)
elsif a.state?(106);
a.remove_state(106)
elsif a.state?(105);
a.remove_state(105)
elsif a.state?(104);
a.remove_state(104)
elsif a.state?(103);
a.remove_state(103)
elsif a.state?(102);
a.remove_state(102)
elsif a.state?(101);
a.remove_state(101)
else
a.remove_state(100)
end
</conditional state>
Hello again. I dont know why, but it works and I'm not getting any error when I accidentally added 99 (it's empty state) below end. Now the skill removes shield by one level as it should. It looks like that:
if a.state?(109);
a.remove_state(109)
...
end
99
</conditional state>
Strange but it works 🙂