TICKING HP

RPG Maker VX Ace

Think Earthbound where the HP slowly scrolls down.

Makes all damage taken from the effects of direct damage skills slowly taken over time, even while you're entering commands from the menu.
If you want to speed it up edit the line:
if Graphics.frame_count % 60 == 0
Change the 60 to 30 for example for twice a second.

Posts

Pages: 1
Line 71 in the script is causing a syntax error. It could be super cool if you took a look at that.
Did you load an old save by any chance? Otherwise could you provide more information please, e.g. when it crashed, what you were doing etc.
Thanks for responding! Just to make sure it wasn't something else causing an error, I copied the script directly from this page to a new, blank project. When run, before the title screen boots up it says this:
Script 'Ticking HP' line 71: SyntaxError occurred.

unexpected '.', expecting ']'
@hp = .max
I think I got it to work. On line 71 change .min to @hp + (@hp_target / @hp_target.abs) Damage and healing seem to be functioning and rolling properly. I will say if I come across any issues with this change.

Edit:With this edit Healing skills will not work outside of battle, but this can be worked around with himework's "common event variables" script and have the healing skill call a common event and use a script call $game_variables = $game_actors[$game_variables].mat and further manipulate the variable you use, then use the change actor hp event. Hope this explanation helps people use this. Also, residual damage like poison does not "roll".
thanks for the fix
@hp = [@hp + (@hp_target / @hp_target.abs), 0].max
author=Ninten0
Edit:With this edit Healing skills will not work outside of battle,

Changing line 95 fixes this
if SceneManager.scene_is?(Scene_Battle)
  self.hp_target -= @result.hp_damage # ticking hp
else
  self.hp -= @result.hp_damage
end

to do poison damage properly, add in to the Game_Actor section (below execute_damage(user) perhaps),
def regenerate_hp
  damage = -(mhp * hrg).to_i
  perform_map_damage_effect if $game_party.in_battle && damage > 0
  @result.hp_damage = [damage, max_slip_damage].min
  if SceneManager.scene_is?(Scene_Battle)
    self.hp_target -= @result.hp_damage # ticking hp
  else
    self.hp -= @result.hp_damage
  end
end

It was discovered that if your damage was higher than your hp, your health would count down but you could still make attack commands. which would result in a crash if you were making command choices when your hp reaches 0.
to correct this add this into the make_damage section above user.hp
if self.hp < @result.hp_damage 
  self.hp = 0
  @hp_target = 0
end
Making the execute damage section look like this
def execute_damage(user)
  on_damage(@result.hp_damage) if @result.hp_damage > 0
  if SceneManager.scene_is?(Scene_Battle)
    self.hp_target -= @result.hp_damage # ticking hp
  else
    self.hp -= @result.hp_damage
  end
  if self.hp < @result.hp_damage 
    self.hp = 0
    @hp_target = 0
  end
  self.mp -= @result.mp_damage
  user.hp += @result.hp_drain
  user.mp += @result.mp_drain
end
I have found another way of fixing the "crash on inputting commands when at zero hp" in a way that still lets damage roll if an actor takes lethal damage. I did it by skipping actor command input processing if hp is not above zero with "if BattleManager.actor.hp > 0". Specifically, modify Scene_Battle to the following:













I have not encountered any major issues with this, but there may still be problems I have not encountered and very likely a more efficient way of accomplishing this. Also, this may be incompatible with scripts that modify the actor command list.
on occasion i receive this error after an enemy attacks, the attack is usually random and isnt the same one every time, not quite sure what causes it or how to fix it, characters its attacking are usually at a health that it wouldnt have killed them or anything, and can happen at any point. any ideas on what to do about it?
Pages: 1