Add State on Low MP, Version 1.00 (Beta)
by bgillisp
Introduction
This script adds a state to a battler when their MP drops a certain percent below a preassigned value. Right now you can set the value globally, or on individual actors and enemies, and you can modify the value with states.
Features
Adds a state to the battler when MP is below a fixed integer value. The state will remain on the battler until the state expires, as set in the database.
Screenshots
None - would require video to show the effect.
How to Use
Install the script by pasting in the materials section, but before main. Make sure to paste the script below any scripts that overwrite the Game_Battler and Scene_Battle class, else it may not work.
Demo
Plug and play, just copy and paste.
Script
On pastebin: http://pastebin.com/24yhbi6e
FAQ
Q: The link doesn't work
A: Notify me so I can fix it
Q: The script appears to not work!
A: By default, the script is disabled unless you notetag someone to have this feature. Since that was the way most that used it wanted it to function, I made that the default behavior. Go to the editable region and change the number to avoid that.
Q: I have the global value set to be something that is not 0.0, and an actor is tagged to have the state apply when MP is zero, but nothing happens when the MP hits zero!
A: Sadly, this is a limitation of how the notetags are being read in by the system. Since the system defaults no notetag to be 0, I had to exempt out that value on the notetag, so the global has to be 0.0 for the apply on zero state to work. IF someone can tell me of a fix for this I'd be happy to try to implement it.
Q: I'd like to have a feature like this for HP or TP instead of MP, can you implement it?
A: Sadly, I don't have the time to do that right now, but in theory if you change all my references from MP to HP or TP, it should do just that.
Q: I have this and Yanfly's engine, why does your script not work?
A: Yanfly overwrote the use_item method, which I alias. My script must go below Yanfly's ACE Engine script to work. If you place it above, my script will not work due to Yanfly overwriting the method.
Credit and Thanks
Dekita, for getting me started on this script many light years ago.
ksjp17, for the detailed suggestions to help me modify this script into something that is hopefully more useful than the original script was.
Author's Notes
Free for use in commercial and non-commercial games, with credit given.
I think this is fully functional, but need some other people to see if I missed anything before we call this completed.
Add State on Low MP (Version 1.00 Beta, Released 5.24.15)
● ARCHIVED · READ-ONLY
-
-
Hi.
This script gives me a stack overflow error if my state has "Remove by Restriction" checked.
A trace of the stack overflow reports line 29 in BaseItem, everytime.
Thanks. -
I can look into it, but I have about 3 other requests ahead of this first. Will take a week or two.
-
You should make the setting to be per actor/enemy and also extend it to equips and classes, or even other states. While maintaining the global one.
Plus the ability to use percent, and of course the threshold should also be changeable per actor/enemy/equip/class/state.
Else, this is extremely limited in stuff that it can do. -
Those are good ideas, but all I ever wrote this script for was the ability to emulate Star Oceans 3's KO on 0 MP system (which it does). I never intended it to go beyond adding one state when the MP is below a certain value, or to make it changeable to different values per actor or anything like that. Maybe if I get some free time I can add those in.
-
I was wondering if you had the time to make this per actor? If you could it would be extremely useful to me, and probably to many others too.
Thanks, and perfectly understandable if you don't have time at the moment. -
How soon do you need it by? Time is limited until early May, but I have most of May free due to semester break.
-
That might be a bit tight, but if it's not done for this project, I can use it in the next, so let's say leave it until May so that you're not under extra pressure.
And thanks for the offer. -
When you say per actor, do you mean a different state per actor, or a different cut-off per actor, or both?
-
If I have understood the script correctly - and of course I may not have - the script will apply to all actors equally. So whatever I select will affect all or none.
But I might not want some actors to be affected at all, I might only want some to have a state (any state) as a function of e.g. their class.
I also couldn't see, though this might be my ignorance, how to set this up when there are actors whose stats are 0MP because they only have TP. As far as I could see, it would mean that they would be getting the state constantly.
Hmm, hope that's clearer.
As for the possibility to vary what state it is, that would be nice, but not (for me, at this time) crucial. -
Yeah, that was a quick and dirty method. What I'm thinking of doing is a total rewrite to base it on notetags, if the actor is tagged to have a state apply on low MP, then apply the state. If no state tagged, do nothing.
Still could be a while to write it, but figure I can brainstorm it now at least. That way when the time is available it can be (hopefully) quickly written. -
yes, note tags would meet what I was thinking of.
-
Entering finals week now, I can probably work on making a new version of this script in a week or so. If anyone has features they would like to see in the changed version, please post it below.
Mods: Can we move this to scripts in developement, since I'm taking this back to the developement stage? -
Just to summarize what I would like
- Able to apply this to individual actors and enemies, not global. I might not want this for a particular actor, and some actors have 0MP because they have no magic, so global won't work for them.
- Ability to set the threshold as a percentage, not just a fixed amount
- Able to apply this to a class.
-
That is a good summary, thank you. I'll have to investigate some on #3, as I'm not sure how to make the class settings and actor settings play nice. I assume actor setting should override class settings? I think that's how most games do it. I'll have to see how Yanfly does it.
Do you propose the state stays on all the time until the MP is recovered, or should it just be applied once? I had it set up as apply all the time, but that causes some errors with remove on restriction settings in the database. Maybe I could do it as apply once, and if the player wants it to be there until the MP is recovered just don't check any removal conditions? Thoughts? -
Yes, I would have thought that actor settings override class settings, it's the sensible way of doing it.
I think the simplest thing on duration is what you suggest - apply it once and leave it up to the user (you said player, but I don't see how the player can determine this) to check removal conditions or not. -
When I use the script in battle whenever the enemy is meant to get an HP knockout i think the state is instantly removed and they stay in the fight? I'm unsure if it's a script conflict or something else, or does this make it so KO is only through 0 mp?
-
That should not happen, as the default KO is still set up to work. See, all it does is it adds a command to the refresh command to add a state if the MP is 0. Otherwise, it passes through to the default set-up. Though, the default state in the set up is not KO, so make sure that is set to what you want.
However....if your enemies do not have any MP at all, weird behavior can occur, as the script has no idea that the enemy doesn't have MP, and still tries to apply the state to them. Make sure all enemies have MP of some sort if you use this script. Even just assigning them 1 MP is enough. -
I see you've updated this. Thanks, I'll have a look at it as soon as I can.
-
Yep, I wiped the old script and started over. It still has the global value, but you can just set it to 0.0 to disable and notetag those you want this to apply to. Also can set a separate state to them, and can even add states to increase or decrease that threshold for the state to apply at (you set which states do this in the array in the editiable region, or just wipe those and put [0] to disable).
I'm calling this version 1.0, it works so far for me in a test project. Let me know of any errors you find!
Also, I could not yet get it to work for classes, wasn't able to figure out how to make the class value apply first, then the actor value. Will read up on it, but for now you could do a separate notetag to each person you want affected.