Floor Damage Toggle HP/MP

Ok so I've looked and looked, and found a few possible work arounds, but I don't know if any of them fulfill my purpose.
Basically I want to be able to toggle floor damage between MP and HP.
(To add some clarification) Story wise I want to create a damage floor, but I want to give one of the characters a spell that can absorb said damage draining their MP instead. If MP runs out then the damage will switch back to regular HP damage.
If possible I would also like to change the damage formula to make it so that it's an MP intensive drain and only affects the one character.
Also I'm not very Java savvy, I know a minimal amount. So if possible I would prefer an in game solution, or an add on.
Can anyone help me with this.

The best workaround I found is using variable to count my steps using an event then using another event to turn that off without using actual damage floors. The problem is I can't seem to get it to work the way I want, well at all really.

Here's what I have so far. I'm running a parallel process with the following.
Variable1 = steps
variable 2 = ActorMP

IF ~ ActorMP /= 0 (does not equal 0)
Change MP: Actor, - Variable1
Else
Change HP: EntireParty, - variable 1

My entire area is supposed to be a damage floor so I don't care about turning this on and off so long as it only counts steps taken in the area.

So I've got this running, but there are a few obvious issues.
There are a few obvious issues with this method. First it counts all steps taken not just the steps on the floor. Second it subtracts the entire variable every time. Next I cant find out how to multiply steps taken by a set number. (I want to subtract like 40 MP/HP for every step. I can set a variable to multiply another variable but I don't know how to set the multiplyer. I'm sure I'll figure this out eventually through experimentation, but this one is hitting me pretty hard.
If there is an easier way to do this then I would really appreciate the help!
I don't know the easier way to do what you want, but looks like you need to add some events, that turn on/off substracting so it was working only on the floors you need (if you have a rooms with damaging floors, just add few events on rooms entrances/exits. if you'll post some screens I could try to help you to figure, where you need to place events so their number was as low as possible.)
about multyplyer: control variables->choose variable you need to multply and choose operation "mul", operand "variable". I think you'll manage by yourself after that
HAHAAA!!!
I've got it!!!

Using Yanfly's YEP .17 Region Event Plugin. I just created a common event and defined it to that specific region and it works like a dream!

However while experimenting I realized that I can also use a constant and that would fulfill my purposes even better, because the player cant just set around and dilly dally if I have it a constant decrease every 60 frames...

Thanks for the help though!
PS I tied your idea (I think it's what you were trying to point towards. MV keeps wanting to add/sub. every 60 frames. So that doesn't work. But this plugin is perfect!
I'm glad I found a Yanfly plugin that suits my needs...

Either way I couldn't find any posts like this so I hope this helps someone else... I'm closing the topic now!
BTW... How do I close a topic? Or mark a thread as complete...
PS I tied your idea (I think it's what you were trying to point towards. MV keeps wanting to add/sub. every 60 frames. So that doesn't work. But this plugin is perfect!
well... you could use 3 variables: Damage=(base damage)*(multiplyer) and just change multiplyer when needed. or make it some harder way (i have three ideas how to do it harder way for now. actually the one I suggested was the third of my ideas. and first one was the hardest ^_^)
I tried that first actually. I got the multiplayer working fine, the problem is that without setting a trigger on every block I cant count steps in a way that allows constant damage on a step by step basis like a damage floor does. It's easy to reset a step counter to 0 using a variable and allow it to go up normally. But if I create a damage calc based on steps I either have to deal all damage at once in choke points (which is just bad game making) Or I have to let it add incorrectly for example 1 step deals 1 damage, 2 steps deals two additional damage three steps three additional damage and so forth. So after taking your third step you've taken 6 damage. And considering that my game is set up so that a players MP swamps their HP even for non-mage classes this is a terrible combo, the first step they take when their mp runs out they are dead... This could work for some other situations but not this one.

I saw an idea elsewhere that would allow me to use a dozen (literally) variables to measure the players position on the floor and use with a conditional branch that deals damage or whatever whenever the player changes position on the map.
If you don't have teleports on your floor then this will work, but it would require an excessive number of variables in order to reset the condition after damage calculation.
This would be SOOO much easier and would give us sooooo many more options and soo much more functionality if the conditional branch offered more options. Instead of just comparing two values against each other if we could compare a variable against it's self and look for a change for example variable x experienced a gain, variable x experienced a loss, or variable x changed.
Or if we could measure the stat of an actor as a condition. For example the MP of actor x changed. Or even the MP of actor x =,<,>, etc...
these small changes would add a lot of functionality.
Basically what it boils down to a an extremely limited conditional branch...
I don't know a lot of coding but I know that conditional branches are one of the biggest parts and a conditional branches that limits your options to basic functionality is a terrible idea... I'm going to see if there is a plugin for that. It would be well worth the download!
I'm not sure (since I didn't needed it myself and can't test it right now) but:
you could use 3 additional variables: lets call them step1, step2 and lim.
first: event that makes step1 set to game data->other->steps
second: parallel process, that makes step2=steps-step1
third: when step2=lim you make step1=steps, step2=0, multiplyer= multiplyer+1 (it coluld be in the same parallel process)
fourth: if you need to give player more or less steps before increasing multyplyer you could just change lim (actually you could go without lim variable, but I'm suggesting it in case if you'll want to make some events/items, that adds/substracts from step limit. something like Poison Rsistance Potion)
As I said, I'm not sure how steps counts (from the beginning of game or from entering the room) and even not sure it will work as I expect it to work, but try it anyway. If it'll work it would be great, right? ^_^

Original thread: https://forums.rpgmakerweb.com/threads/floor-damage-toggle-hp-mp.85459/