Damage per MP used

Hey there guys! YEEART here coming in for a request.

I'll first start off by asking: is what I'm going to say possible, even without the use of scripts?

What I'm requesting for (hoping it's fairly easy to script), is a state which can be inflicted upon using a skill. What this state does is simply inflict damage depending on how much MP you use. For example: you lose 100 hp per 1mp used.

That's all there is to it. If it's too vague, please, tell me. I'm completely ignorant when it comes to scripting, so I'm not so sure how vague I am.
How do you determine how much mp is used? Is it like there are many skills that can inflict that state and the damage would depend on the skill used? If yes, then it would be more complicated than if only 1 skill that can cause that state... Unless you make a copy of that state per skill. Then you can just use a script like my States EX so that you can define custom damage formulas for state slip damage.
As you will know exactly how much MP each skill is going to cost, you can just simply put the HP damage into the damage formula box.  No need for a state.  For example, you have a skill which costs 10MP, so that equals 1,000HP damage to the user.  (Do you really want it that high?  It seems colossal.) 

a.hp-=1000; your_damage_formula_here
He wants a state to deal the damage not the skill...


At least that's what I understood from his post. 🙂
Ahh, I think I may have been too vague which may have caused a misunderstanding (unless I'm simply reading your comments incorrectly). Here, let me create a scenario:

Monster X uses: [insert skill name here], Player 1 loses 200 HP, Player 1 falls into the [insert state name here]. Now, now that player one is in state X, for every MP he uses (5 for example), he loses 500 hp (I may be going a bit too extreme with the hp loss). I hope that makes things a bit clearer now.
Ah... you could use Yanfly's Lunatic states for that I think.
While it does fill requirements for other things I have in mind, unfortunately it isn't exactly what I want, so I'll say sorry, as well as thank you 🙂 . Saves me the effort of making another thread in the future for something I have in mind.
Inflicting the state along with the 200HP damage is not a problem.  What is highly problematic is being able to determine which skills the player uses while afflicted with the state and the amount of MP that each skill used requires.

Presumably the player has the option of just using Attack, or a skill which uses TP, so avoiding the penalty (and yes, I think that 100 damage for 1MP is way overpowered),   

I personally have not seen anything like this around.  It might have to be custom written.
The solution (as you pretty much stated), was the force the player in using Attack, or TP based skills. I intended it to be a state where it sort of catches the player off guard, forcing them to put in 100% attention. It's hard to come up with unique and different states, or simply running into a problem where states start turning too similar. A shame that a script like this doesn't exist (well, I'm not aware of at least). It was worth a shot though. 

#Bringinginnovativeideas. Nah I'm just messing around.
Ssomeone may be prepared to write it for you, so it's worth while leaving this thread open in the hopes that a scripter might see it and be interested.

What I suggest you do, however, is to edit your opening post which is quite confusingly worded.  You need to catch the eye of a potential scripter, and the clearer you are about your requirements, the more likely you are that someone will help out.

So full and clear description.
I made a little snippet for you:

Spoiler
module MPDamageHP # Insert any state IDs here which would inflict the "Cursed Magic" state. # Cool name for the state, right? States = [26] # The damage multiplier. # 10 means the damage the user will receive will be the skill's MP cost # multiplied by 10. # 0.1 would mean that the user will get damaged by 10% of the used skill's # MP cost. DamageRatio = 10 endclass Scene_Battle < Scene_Base alias add_evilmp_state2355 use_item def use_item item = @subject.current_action.item add_evilmp_state2355 if item.is_a?(RPG::Skill) && MPDamageHP::States.any? {|st_id| @subject.states.include?($data_states[st_id])} @subject.hp -= @subject.skill_mp_cost(item) * MPDamageHP:😀amageRatio end endend
Put it anywhere on your script list below Materials but above Main.

If you got a script which overwrites the same method I aliased, you must put this below that script!

Set up the settings in the module and you are done.

Note that the damage caused by the state happens AFTER the skill's execution. This is to prevent crashes happening from the user dying before executing the skill which is already loaded by then.
Nothing. But. Respect!

Thank you so much Sixth, this works perfectly, and you even mentioned something fatal (literally) I forgot; the damage was meant to be inflicted AFTER your turn! Seriously, you're a life saver dude, thank you.

Edit: What are the terms of use as well, may I ask?
You are welcome!


Everything I post is free to use for whatever purpose you want, unless I state it otherwise. So, it's free.


Credit is optional, since it's really not a big script, took me 3 minutes. 😀


I forgot to mention that it is using the evaluated MP cost of the user, which means that if the user got some MP Cost reducing features from whatever sources, the damage inflicted will be reduced as well with the same rate (or increased, if the MP Cost feature actually raises the skill's MP cost). Thou it can be changed to the skill's raw MP cost easily. If you want it that way, just let me know and I will change it for you.

Original thread: https://forums.rpgmakerweb.com/threads/damage-per-mp-used.44673/