Wasn't sure whether to post this here or JS support. Anyways, in my project all potions (HP or MP) restore some amount per turn, as in there is ONLY as HoT component to the potions in my game. This creates an issue when trying to use these potions outside of battle, however. I would like them to heal some amount every several steps the player takes. Is this possible?
Potion Healing Every X Steps?
RPG Maker MV Supportif you make it apply a state, yes. then it's just a matter of a parallel common event checking for the state, if it exists, restore HP.
It should be possible, but you will most likely need a Plugin for that. As far as I know MV doesn't have a built in step counter like some of the older RPG Maker entries. You might be able to do that with an common event, but that would probably end up being quite a chore to set up.
Yea, it already had a state being applied, which works for combat anyways.
JavaScript:
<Custom Regenerate Effect>
var hpRegen = Math.round(1.5 * target.level);
target.gainHp(hpRegen);
</Custom Regenerate Effect>
So if I use a common event, how do I get it to count steps?
@Frostorm You can set an ingame variable that tracks the steps and then use that variable to create a simple algorithm like so,
Disclaimer,
I have no idea if this will work I just wanted to give you a rough idea on how to go about it.
JavaScript:
// create a variable outisde of the regenerate effect that will be the initial steps, this variable should only be defined once when the item is used.
$gameVariable.setValue(id of initial variable) = $gameVariables.value(id of step counter variable);
// then use it like this in the regenerate effect
var initialSteps = $gameVariables.value(id of initial variable)
var currentSteps = $gameVariables.value(id of step counter variable)
var numberOfSteps = 5 // set this to how many steps you want it to take before it regenerates.
var hpRegen = Math.round(1.5 * target.level);
if (currentSteps == (initialSteps + numberOfSteps)) {
target.gainHp(hpRegen);
initialSteps += numberOfSteps
}
Disclaimer,
I have no idea if this will work I just wanted to give you a rough idea on how to go about it.
Step number is available in the database - Control Variables --> Game Data.
@Frostorm Also possible is just using a state to be removed after x-amount of steps and set it with Ex-Parameter HP Regeneration. Essentially opposite of the extant poisoned state. I know you mentioned every few steps but with some percentage increases you may be able to achieve the volume of health to be recovered. No need for common events. Can have potions give a burst heal then add the state. Turn removal I think can too be applied easily. I believe this can be done with the vanilla engine.
Yea I already considered the Ex-Param method w/ HP Regen, but that would mean tank builds get healed for more, which just wouldn't sit right w/ me. If in the end I can't get steps to work, then I'd be ok w/ healing over "time", aka frames.
I made a plugin that counts steps for encounters so that the count persists between maps. You could probably use it with minimal amendment to achieve what you need if you've got a basic grasp of JavaScript. Happy to provide it if it would help.
That sounds great, I would definitely it. Where can I find your plugin?
My plugin was actually no good for it so I made you one that is. If you can read basic JS then should be easy enough to amend for what you want, help will show you how it's currently configured. Let me know if you need any help with it. Should save you a parallel process at the very least.
Awesome, it looks simple and very easy to read. Thank you! ^.^
Edit: I just noticed a huge issue when using steps for HoT. Basically, if the player isn't moving then they don't get healed lol. I think I'm gonna have to use time/frame based HoT instead. I tried the following common event, but the "wait" portion makes it so the player can't move during that time. Is there any way around that?
Code:
◆Change HP:{ActorID}, + {Health}
◆Wait:180 frames
◆Change HP:{ActorID}, + {Health}
◆Wait:180 frames
◆Change HP:{ActorID}, + {Health}
◆Wait:180 frames
◆Change HP:{ActorID}, + {Health}
Original thread: https://forums.rpgmakerweb.com/threads/potion-healing-every-x-steps.129488/