hello rpg maker forums again! im working on my first little game, and I wanted one of my characters to have a very powerful state that lasts a few turns, and im wondering if I could make the character take alot of damage when the state ends, im gonna tool around but I figured asking wouldnt hurt in case I get stumped.
question about states ending.
RPG Maker MZ SupportBy default there's no mechanism to make things happen when a state expires.
You can either find a plugin that adds this feature, or you can try eventing it using a base troop plugin.
You can either find a plugin that adds this feature, or you can try eventing it using a base troop plugin.
interesting, thank you for your help!
You can use VisuStella's Skills and States Core plugin which you can get for free on itch.
After installing the plugin just copy and paste this in the notes section of the powerful state in the database.
Change the "9999" to whatever number you want, just make sure there's a negative sign there.
Edit: In case you don't want to download a large plugin for one state:
Just paste it into notepad, change powerfulState to equal your target state and save it.
After installing the plugin just copy and paste this in the notes section of the powerful state in the database.
JavaScript:
<JS On Expire State>
user.gainHp(-9999)
</JS On Expire State>
Change the "9999" to whatever number you want, just make sure there's a negative sign there.
Edit: In case you don't want to download a large plugin for one state:
JavaScript:
/*:
* @target MZ
* @plugindesc Deals damage on state erasure.
* @author Lowrell Lovelace
*/
(() => {
let powerfulState = 2;
let damage = 9999;
const _Game_BattlerBase_prototype_eraseState = Game_BattlerBase.prototype.eraseState;
Game_BattlerBase.prototype.eraseState = function(stateId) {
if (stateId === powerfulState) this.gainHp(-damage);
_Game_BattlerBase_prototype_eraseState.call(this);
}
})();
Just paste it into notepad, change powerfulState to equal your target state and save it.
oh wow I didnt know any of the visustella stuff was free, I dont mind installing it as ive seen some of the features and they seem quite useful, thanks a bunch!
the visustella one worked pretty well, could I make the gainhp a percentage? this is more for future projects as I know how much HP the actor will have when they get this skill so I can set a flat rate without having to worry about scaling to any great extent.
JavaScript:
<JS On Expire State>
user.gainHp(-user.mhp * .01)
</JS On Expire State>
Take whatever percentage you want and convert it into decimals, so 1% would equal .01.
Original thread: https://forums.rpgmakerweb.com/threads/question-about-states-ending.183083/