I have an ability that grants death immunity for a few turns. However upon the end of the battle it is instant game over if the player ends the battle with this state. I would prefer to make it so that the player cannot have <1 hp for the duration of the state but I can't think of any way to do that.
My other thought is to not have the state cleared at the end of battle and then have it removed during scripts. Really I'm at a loss as to what approach to take to get the desired effect. Any input would be appreciated, Thanks
I've done something similar but didn't have this problem, not sure what I did different. In my version the immortality state also gives a small health regen boost (5% in my game, which was about 2 HP). That might work as I think it will tick the regen before removing the state.
You can modify the damage parts of the battle script to check for that state. if the unit has that state, then the max damage that you could deal to him should be equal to his hp - 1
try this
class Game_Battler < Game_BattlerBase def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) value = self.state?(State ID for immortality here)? [value,self.hp-1].min : value @result.make_damage(value.to_i, item) end endthough it might be incompatible if your using any extra battle engines, since most of them overwrite this method too (but I can't think of how to do it via an alias so I did overwrite)... anyway, if ur using a script for battle engines you can just copy the second to the last line (the one that has the .state?), and paste it to that same place in the battle engine script...
I am using Ace Battle Engine
I placed your line in the Ace Battle Engine Code with no luck
#--------------------------------------------------------------------------
# alias method: make_damage_value
#--------------------------------------------------------------------------
alias game_battler_make_damage_value_abe make_damage_value
def make_damage_value(user, item)
game_battler_make_damage_value_abe(user, item)
rate = item_element_rate(user, item)
make_rate_popup(rate) unless $game_temp.evaluating
value = self.state?(26)? [value,self.hp-1].min : value
end
I took a online class on ruby and I understand it but still I can't write script it's very frustrating I don't understand how I am supposed to learn it 🙁
because the damage is already set before that call...
since yanfly doesn't seem to overwrite it, you can create a new script at top of ABE, and paste the whole code in it...
You sir are a genius, might I bother you for one more thing > < ?
What exactly is your process for figuring something like that out?
I want to write a script to use in combination with the yanfly stamina based system and I have a basic idea of what the code should look like. But I don't know where it should be placed or what should trigger it. I want to make it so abilities go on cooldown for x seconds and the cooldowns only tick down during stamina regeneration times.
Well, I started scripting with Wc3 years ago... I started with looking at the preset functions and figuring out how they were written, and how they work... Then I proceed to trying out things... So basically, trial and error...
And I did that same thing with RPG Maker... and so with visual basic
Anyway,for cooldowns, yanfly has a script for that I believe...
Though I still find the way scripts are arranged in RPM Maker quite confusing... Also, it's a bit harder to learn than wc3 and visual basic, mainly because there's no things such as auto-complete and function list for RGSS3 inside the editor... so you really need to know what you're writing...