[XP] MP Slip Damage state script?

Hi. I’d like to achieve a state that consume actor’s MP (or SP as it’s called in XP). It’s just like the Poison state but it would affect the MP instead of HP.
I googled it but didn’t find any for XP.

Any help would be appreciated. Thanks in advance!
Why do you need a script for that? Is MP Damage not already an option for states in the database?
In XP, it's not.

There was one script I had "fixed" in the past that does this: https://forum.chaos-project.com/index.php/topic,2481.0.html
Damn, I'd forgotten how many things XP lacked.
@KK20 Thank you! It works great.
Btw, how can I edit it so there's no screen flash when SP damage happens? I'd like to use another effect instead, like change screen tone or play a animation.
It's literally the last block of code in the script. It checks each actor in the party if they have a slip damage state. If so, it flashes the screen red or green.
You could make a hash module script that adds extra info to the statuses, or if that's not your thing... you could try editing the scripts to deal the slip damage to the SP instead of the HP when dealing with certain status effects. You want to edit the slip_damage_effect on Game_Battler 3 and check_map_slip_damage on Game_Party.

Jeez, even RPG Maker 2003 has more options for "Slip damage".

Oh yeah, and you also want to edit slip_damage? in Game_Battler 2 to check for the states you want to do damage to SP instead of HP.
@KK20 Thanks! May I ask how to get the MP damage to apply the effect to it only? Because I want to keep everything as default, just different effect for MP damage.

@BloodSoakedPuppeteer98 Thanks! The script KK20 mentioned above has solved most of what I asked for.
You're going to have to explain what kind of effect you want.
Sorry for not explaining it better. It's probably Change screen tone or Show picture or maybe both.

For more details, I'm creating a skill that displays the mana traces. This skill is used as a switch to turn on/off the mana vision. If the player forgets to turn it off, it will keep draining an actor's MP. The effect is to remind players that the skill is on, and it's disposed when it's off. I was inspired by Witcher Sense in The Witcher 3. That's what I'm trying to achieve.
Just a question: is there any reason why this has to be a state and not just some elaborate common event system?

You would just make a skill call a common event that toggles a switch on or off and applies the screen effect that you want. A second common event is set to a parallel process that requires the aforementioned switch to be on, which will do the MP/SP drain, animate something, etc.
@KK20 Oops! I didn’t know I could do that with common event. The common events work great. Thank you so much! 🙂

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/xp-mp-slip-damage-state-script.123309/