[VX Ace] [Yanfly Lunatic states] Death if MP = 0

Hello everybody, I have a question, I'd like to make a stat makes the affected dies if its MP is equal to 0, of course, I want they die if their HP is equal to 0 still.

I'm using Yanfly's Lunatic states' script (https://github.com/Archeia/YEARepo/blob/master/Battle/Lunatic_States.rb) so if there is an easy way to make it via this script, please feel free to post using it.

Thanks for your attention 
http://pastebin.com/24yhbi6e

That should do the trick. Just set the values for when to apply the state (default is ten, so change it to 0), and change the state to apply to 1 (the KO state).
Actually you can make a Troops in the database and event it. 

Eventing it you can add something to be executed in each turn.

You can then call a common event.

You go and create a common event that checks current MP.

If 0 the hero dies LOL.

Else nothing happens.

There! Using just eventing.

EDIT: Or use the script that :ninja:   bgillisp :ninja:   gave you I guess 

Second edit:

[SIZE=14.4444446563721px]Problem is that using eventin this check occurs some certain time instead of instantly....[/SIZE]

so go with the script without hesitation.
bgillisp, thanks a lot, but... How do I make that only happens when the player/enemy has certain state?
I never got the script that far I'm afraid, as I wrote it for a quick fix to do like Star Ocean 3 did (KO on no MP). Do you intend it to only happen on one specific state? If so I can probably add a quick fix for that. If you need more than one though that might be beyond what I can do as a scripter at the moment.
Only when they have certain state, they'll die if their MP is equal to 0, can you make a fix for that? Thanks
I'll see if it can be done. Give me a couple days though.
An edit to bg's script

Code:
	module BG_mp_zero_state  #state that is needed for the 0 state to work  Zero_state_required = 10end	class Game_Battler < Game_BattlerBase  alias bgmp_zero_state_refresh refresh    def refresh      #Call aliased method      bgmp_zero_state_refresh      if(BG_mp_zero_state::MP_zero_state_switch)        if(self.mp <= BG_mp_zero_state::Mp_zero_value and self.state?(BG_mp_zero_state::Zero_state_required)))          #Add the desired state.	  if(enemy? and BG_mp_zero_state::MP_zero_enemy_affected)	    add_state(BG_mp_zero_state::Mp_zero_state)            return	  end	  if(actor? and BG_mp_zero_state:: MP_zero_actor_affected)	    add_state(BG_mp_zero_state::Mp_zero_state)	    return	  end	end        remove_state(BG_mp_zero_state::Mp_zero_state)      end #End if for switch    endend #End of Game_Battler class
An edit to bg's script

module BG_mp_zero_state #state that is needed for the 0 state to work Zero_state_required = 10end class Game_Battler < Game_BattlerBase alias bgmp_zero_state_refresh refresh def refresh #Call aliased method bgmp_zero_state_refresh if(BG_mp_zero_state::MP_zero_state_switch) if(self.mp <= BG_mp_zero_state::Mp_zero_value and self.state?(BG_mp_zero_state::Zero_state_required))) #Add the desired state. if(enemy? and BG_mp_zero_state::MP_zero_enemy_affected) add_state(BG_mp_zero_state::Mp_zero_state) return end if(actor? and BG_mp_zero_state:: MP_zero_actor_affected) add_state(BG_mp_zero_state::Mp_zero_state) return end end remove_state(BG_mp_zero_state::Mp_zero_state) end #End if for switch endend #End of Game_Battler class
Do I add that in the same script or just in another place under the script bgillisp made?
Just put it under his script... that's easier to do...
Using them already and it shows a mistake in this line

if(self.mp <= BG_mp_zero_state::Mp_zero_value and self.state?(BG_mp_zero_state::Zero_state_required)))
Ah. it needs to be in a single line... can't do that on the post because it does a word wrap
It's in the same line already, it's so... Bizarre
what error does it show?
This one

961398_989093937786226_204411456_n.jpg
Ah, seems like there was an excess ) 

There should only be two ), not three
Now showing the "Stack level too deep" mistake
probably coz it uses the same alias as the original... XD

just change

alias bgmp_zero_state_refresh refreshdef refresh#Call aliased methodbgmp_zero_state_refresh
into 

Code:
alias bgmp_zero_state_refresh_two refreshdef refresh#Call aliased methodbgmp_zero_state_refresh_two
Nope, still the same
then just replace the old method from the original script with the edited one...

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-yanfly-lunatic-states-death-if-mp-0.35401/