Zero Mana = Dropping Health

Hi,

I'm new here on this site, so please be patient with me :3 And I'm also sorry if I post this on the false forumtopic (and ofc for my language).

What I need is a script, where if a player and his followers have zero mana/bluebar the health will constantly drop.

I know it's probably very easy, but I can't write scripts on my own, can someone help please?

Cyanh

EDIT: (more Information)

It should drop per step (like the poison status in the old Pokemon games) and in percentage (a little amount like 5percent), so the character won't die from it.

But it would be great if percentage could be custom and can be changed.

Also it should only happens individually like if actor x has zero mp, his health should drop whereas actor y health maintains as long as his mp is over zero.

This should happen in battle AND on the map. So in battle it should drop per turn whereas on the map it drops per steps.

And if it's possible there should also be a sign or a signal when health is dropping by this effect. Take the first Pokemon game for example where the screen was blurring and then turned back to normal everytime the health dropped.
Should this happen only in battle or outsite too?
In battle and outside
you still need to give more info, like how many points should be removed in what time frame. This is especially critical for outside battles, because there is no "time" during regular map games. So you have to decide if it should only drop per step, or if it should drop one point after X frames (a second has 60 frames) and so on.
Oh, sorry of course. I don't really know yet how much it will affect the gameplay, so i will try to stick with this one: It should drop per step (like the poison status in Pokemon) and in percentage (a little amount like 5percent), so the character won't die from it.

But it would be great if percentage could be custom and can be changed.
a little amount like 5percent
5 percent means that the actor goes from full health to zero in twenty steps. On most maps, that isn't even going to be enough steps to move across the map, so this is only survivable if the player can remove the problem by items or skills no matter where he is...
yeah there are items drop by foes or shop items who can refill the mana/bluebar. The effect only takes place if the player has 0 mana/bluebar. And also that's why it would be good if one can change the amount afterwards in the script.
5 percent means that the actor goes from full health to zero in twenty steps. On most maps, that isn't even going to be enough steps to move across the map, so this is only survivable if the player can remove the problem by items or skills no matter where he is...
More than twenty, actually. Five percent of the remaining health is what he is aiming for I assume, not five percent of the full health (otherwise the characters could die from it).
Is there anyone who want to tackle this challenge? 🙂
Do you want this happen to all actors individually?

So for example if actor 2 mp is zero only actor 2 will loose health?
oh yes, it should only triggers when actor x got zero mp 🙂 Then ofc actor x will lose health but actor y don't
If you want this to drop per step, then you might be wanting to make this through a state (outside map), but inside battle, per turn. Those varies.
And if it's possible there should also be a sign or a signal when health is dropping by this effect. Take the first Pokemon game for example where the screen was blurring and then turned back to normal everytime the health dropped.

I eddited my post at the beginning with more details.

And is there anyone out there who think he/she is able to do this?^^
If you want to go the route of having it controlled via state that's pretty simple:

#Adds a state if mp = 0, removes said state when mp is greater than zero.#Very simple snippet requiring no credit whatsoever, so use and modify as #desired-Alex Amnellclass Game_BattlerBase    def mp=(mp)    @mp = mp                                                    if mp == 0       self.add_state(2)     else      self.remove_state(2)     end    refresh  endendInsert this snippet above main and change the state id (2 by default) to a custom state of your choosing. By default in a new project this would apply the poison state to any character with zero mp until he/she gained some mp back. Which means that in battle they would suffer -10% hp per turn and -10% hp every 20 steps taken out of battle. Obviously you could change this to a custom state that does whatever you want it to do. As this effect refreshes by default it should stay on the character permanently until their mp is restored, however just in case I'd recommend making the state unique to this situation and thus untreatable through any other means. 
Many thanks! I will try this out 🙂
Edit: Srry false alarm.

How do I edit the number of steps? Sorry I'm quite new to this.
oh and I have one more problem, the effect is a bit delayed, how do I fix it?
Here is an updated version that overwrites steps per turn to whatever you want for easy reference:

#Adds a state if mp = 0, removes said state when mp is greater than zero.#Very simple snippet requiring no credit whatsoever, so use and modify as #desired-Alex Amnellclass Game_BattlerBase    def mp=(mp)    @mp = mp                                                    if mp == 0       self.add_state(2)     else      self.remove_state(2)     end    refresh  endendclass Game_Actor  def steps_for_turn    return 20 #Number of steps out of battle that = 1 turn in battle for slip damage  endend



oh and I have one more problem, the effect is a bit delayed, how do I fix it?
First of all define under what circumstances you get a delay and what scripts you have. When I test it under the default battle system I give the character enough mp at the start to perform 1 magic attack, upon using the attack and depleting mp they instantly become effected with the state and the instant mp is restored the state goes away. The only time that I can field a delay at all is if I start the game with a character with zero mp from a fresh load and it waits until it is his/her turn to apply it in battle or until the player takes one step out of battle. If you want to start your game with the effect active then just apply the state directly (though it applies on it's own with one step taken or one turn, so the delay is minor if that is what you are referring to.)
First of all thanks for the updated script^^

First of all define under what circumstances you get a delay and what scripts you have.
So I tested it on a testmap. I put an event where the mana of the player get reduced to 0. But the state need 10 or 20 steps (depend on the step counter) to apply. This is the delay I mean.

These are the scripts I additionally use:

Yanfly Battle Engine

Yanfly Lunatic Targets

Yanfly Smart Healing

Galv's Visibility Range

TheoAllen - Anywhere Texts On Screen

MOG - Active Chain Commands

MOG - Enemy HP Meter

MOG - Battle Result

I can't see how these script may affect your script.

And I also have some custom scripts where I removed TP and Formation from the menu.
So I still have to make a state to get it to work because I don't want it automaticly? This could be really useful.

Wonder if I could have the state only affect only certain character classes or characters?

Original thread: https://forums.rpgmakerweb.com/threads/zero-mana-dropping-health.25900/