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

The stack level too deep error occurs if you *ever* use remove by restriction on the state that is to be applied, as I wrote it to force the state onto the character, and if that state has remove by restriction, for some reason the game will remove it, and reapply it in an infinite loop, and it will never end.

I'll see if I can merge these scripts tomorrow unless you both figure this out while I'm asleep, its late in my time zone so I better look at this more when I'm fresh.
So, bgillisp, could you solve this trouble?
I can try. I'm a noob scripter still, and slow at it too. Why don't I try writing a custom one to perform what you want, as I think with all the extras in that code it will get crazy. Its just supposed to KO someone with a certain state if their MP hits zero, right?

Edit: Got it, I think. Delete the script I gave you, and add this script by Yanfly instead that I've modified to make it work. It is the lunatic state punishment add on. In it, I added a check for a special notetag (under case 9), that will KO whoever has that notetag if their MP is zero.

Link: http://pastebin.com/6mu0szwm

Use the notetag <shock effect: KO MP ZERO> on the state that is supposed to kill when the MP runs out, if you want the KO to occur as soon as they take MP damage. If you use react effect, it will wait until the end of the turn to do the KO.

This way if you ever decide to add more states that do this, you just need to add the notetag.

Incidentally, you will also gain the add-on I wrote to allow you to regen fixed HP per round of combat (its under stat slip or stat heal), though it was an ad-hoc add on, so might be hard to use.
People... I just made it happen using events.  😛

One for field and one for battle. 😛 😛

Not shiny and 100% accurate (it does not do a -1 per step) but it does the trick!

In case you want move damage, talk to the npc to get the MP poison state.

Walk to decrease your MP (not so accurate here).

If you walk enough you will die.

[SIZE=14.4444446563721px]OH! You are the rock, sorry for that! [/SIZE] 😛

Check the transparent event to see how it works.

If you want a combat turn based poison,

do the above to understand how i did it,

THEN RESTART THE GAME.

Talk to the NPC and then interact with the bat to enjoy it in battle.

That was a little.... tricky!

I built it upon the transparent event code I already had made, yeah I was THAT lazy, so some variables stay with same name.

I provide you a tip so you wont get confused.

Open the database and go to Troops.

See what I did there? Two pages event.

Now go to Common Events and study what I also did there.

Notice the trigger switches on the top right of the parallel process events?

These are important.

https://www.dropbox.com/s/9l04qbnjg3zd7ya/MP%20Poison%20with%20KO.zip?dl=0

Download, unzip, OPEN the project then test play.

The most important thing is to understand how YOU can do this.

Tip: Eric's current X variable works also as Current Turn. Same goes for Eric's Initial X variable. It is initial turn. 😉

And also... if you won't get it how I did this happen in battle, it's ok.

It is too complex. I was debugging it since now.

Get it, try it and tell me if that's what you want to happen.

If yes, well.. I will explain you what I did step by step.

But only if it is EXACTLY what you wanna happen in game.

Tell me if I nailed it of failed it! 😛
Ok, thanks a lot to both of you, I'll stick with the scripted alternative made by bgillisp because it works as I want, with not too much effort (I have the Lunatic states Punishment pack installed lol)

Dreadshadow, thanks for the eventing alternative, it works, but I prefer the one bgilips gave me, but this solution... You nailed it!

Ok, this post can be closed, it's solved
Just make sure to replace the lunatic states punishment add on with this script, else you may get a stack overflow error (having both the original and my corrected version included will cause issues at some point down the road). But, glad it is working for you!
Just make sure to replace the lunatic states punishment add on with this script, else you may get a stack overflow error (having both the original and my corrected version included will cause issues at some point down the road). But, glad it is working for you!
I just pasted your add-on in the end, like this

    #----------------------------------------------------------------------

    # Punish Effect No. 10: MP KO

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    # Death if MP = 0

    #

    # Recommended notetag:

    #   <shock effect: KO MP ZERO>

    #----------------------------------------------------------------------

    when /KO MP ZERO/i#[ ](.*)[ ](\d+)([%%])/i

      return if user.mp > 0

      user.hp = 0

 

So, hopefully, it shouldn't create any trouble
Yep, that should work just fine!

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