I'm working on a game that only has one playable character. Because of this, abilities like life and items like stimulant won't be useful at all because there won't be other party members to use them on the character. So I'm looking for a way to create a status effect that allows the character to revive with a set amount of health if knocked out. I've seen something like this for MV, but I need something that will work for VX Ace. Could anyone here help me out with this?
Autolife Status
RGSS3 Script RequestsIt will take a script to do this. I think a good starting point will be Yanfly's Lunatic States Script.
Moving to RGSSx Script Requests
I've tried something similar. Let's see, I believe it went something like this:
How this script goes is that if you have a Auto-Life State (2), when you die, instead of adding the usual death state, it will consume the autolife state and restore 30% of max HP.
Code:
class Game_BattlerBase
def refresh
state_resist_set.each {|state_id| erase_state(state_id) }
@hp = [[@hp, mhp].min, 0].max
@mp = [[@mp, mmp].min, 0].max
if @hp == 0
if state?(2)
remove_state(2)
remove_state(death_state_id)
@hp = (mhp * 0.3).to_i
else
add_state(death_state_id)
end
else
remove_state(death_state_id)
end
end
end
How this script goes is that if you have a Auto-Life State (2), when you die, instead of adding the usual death state, it will consume the autolife state and restore 30% of max HP.
Is there a specific part of the script this needs to be inserted into?
Short answer: Where you put the fancier scripts, under Materials.
Long answer: How Ruby works is that, if there are two methods of the same name in the same class, the later method is the one that will run. Most big scripts know this, so instead of asking people to paste several snippets all over the place, they can be simply placed in one page on the database. Even the bug fixes that comes with Ace are this.
Long answer: How Ruby works is that, if there are two methods of the same name in the same class, the later method is the one that will run. Most big scripts know this, so instead of asking people to paste several snippets all over the place, they can be simply placed in one page on the database. Even the bug fixes that comes with Ace are this.
Okay, I think I got it working. It wasn't working with the battle test, but when I playtested the actual game, it worked properly. Thanks, dude.
Original thread: https://forums.rpgmakerweb.com/threads/autolife-status.90559/