Only One Status Affliction At A Time

Hello everyone,


What is the best way to implement a system where status afflictions like poison can only affect one character at a time? For example, when a new status affliction is applied it overrides the old one and it simply disappears.
Your question is a bit confusing - the thread title and the example seem to indicate you only want a character to be able to have one status affliction at a time.  But your first sentence seems to indicate you only want a status affect to be applied to a single character at a time.  Can you clarify which one you mean?
I can only guess that what you have to do is make everything that afflicts a status "cure all status" first, so there is no status, and then they get poisoned.
Your question is a bit confusing - the thread title and the example seem to indicate you only want a character to be able to have one status affliction at a time.  But your first sentence seems to indicate you only want a status affect to be applied to a single character at a time.  Can you clarify which one you mean?

what he means is that a character can only have one status affect. Read the second sentence and ignore the first one.
The first sentence is a clear contradiction.  How do you know the first one is to be ignored, and not the second?
If you want a state to only affect a single character just go to the skill that inflicts said state, and make sure Scope is set to One Enemy.


If you want a character to only have one state at a time go through each of your states and add a Trait that says, if this state is applied, it cures all other states. Say your states are Poison, Blind, and Paralysis - you would add a Trait to your Poison state that has a 100% chance of curing Blind and Paralysis.



Either way, pretty simple solution~
Perhaps an example will help clarify things. I'm sorry if my explanation was confusing. 


Example: A battle starts and there is a bat against the player's party. The first character in the player's party casts a spell to apply poison to the bat. The bat is now poisoned and the effect lasts 4 turns. The next character in the player's party casts a spell that applies paralysis.  It paralyzes the bat but the poison effect is removed since only one character can have one status affliction at a given time. 
If a skill has a status effect, will it ALWAYS be applied?  Is there a chance the skill itself might hit but the state not be applied?


If it's guaranteed that a state will be applied, you could just put this in the damage formula of any skill that applies one of these states:


b.clearStates(); .....


where ... is the actual damage formula.  


That will just remove any states the target already has.  However, it would remove ALL states, so you'd want to be sure that's what you're after.  If there are any "good" states you want them to keep, you'd have to take a different approach.
Clearing all states would probably not work in my case. The current project I'm working on uses states that grant the user new skills. (The "good" states you mentioned.)


Also, this project has guaranteed status effect application skills and skills that apply status effects by chance. 
So you need to have a way to differentiate between the 'good' states and the 'bad' ones - the ones you want to be removed, and the ones you want to keep.


If you put <keep> in the note tags of all the good ones, something like this might work:


b.states().forEach(function(state) { if (!$dataStates[state].meta.keep) { b.removeState(state); }; ); ...


with the actual damage formula at the end.


I haven't tested this.  If it gives you an error, please post what is in the console.

Original thread: https://forums.rpgmakerweb.com/threads/only-one-status-affliction-at-a-time.71046/