slow hp bar animation

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
When an enemy inflict damage to the actor I don't want the bar to go down directly to the inflicted value, but to go down slowly in order to give the player a way to intervene, for example to heal himself, if he gets it in time. This function is also in earthbound.
Example:
The actor has 100 hp
the enemy inflict 200 hp
the actor is about to die, but if the player is fast he'll be able to use an item or an heal ability.
I hope you understood (i'm italian, so probably i wrote something wrong)
 
Last edited:

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
basically i want 2 things:
- hp slowly decrase when damaged
- the player able to use menu while hp are decrasing
like earthbound, but without the rolling numbers.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,787
Reaction score
5,209
First Language
Dutch
Primarily Uses
RMXP

@Ina00 , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
Code:
#==============================================================================
# ** Earthbound-Ish Odometer Roll [Graphical Edit]
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Thread: rmrk.net/index.php?topic=47693.0
# Date: February 17, 2013
# Edit date: October 24, 2020
#==============================================================================
# Edit:
#------------------------------------------------------------------------------
# Removes the odometer graphics. Just drains HP and MP with default gauges.
# Credit the original author (cozziekuns) and follow their terms of use
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to emulate the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3). This
# certain addon addresses the infamous HP/MP scrolling system that made battles
# that much more intense.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================
# [Unneeded] Graphics:
#------------------------------------------------------------------------------
# You must have two Odometer pictures in your Graphics/System folder. One of
# them must be named "Odometer_HP", and the other one must be named
# "Odometer_MP". Obviously, they represent the odometer for HP and MP values,
# respectively
#==============================================================================

#==============================================================================
# ** Cozziekuns
#==============================================================================

module Cozziekuns

  module Earthboundish
  
    Odometer_Roll_Speed = 12 # Smaller speeds are faster than larger speeds.
  
  end

end

include Cozziekuns

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor

  attr_accessor :odometer_hp
  attr_accessor :odometer_mp

  alias coz_ebisohd_gmactr_setup setup
  def setup(actor_id, *args)
    coz_ebisohd_gmactr_setup(actor_id, *args)
    @odometer_hp = 0
    @odometer_mp = 0
  end

  alias coz_ebishod_gmactr_execute_damage execute_damage
  def execute_damage(user, *args)
    if $game_party.in_battle
      on_damage(@result.hp_damage) if @result.hp_damage > 0
      @odometer_hp += @result.hp_damage
      @odometer_mp += @result.mp_damage
      user.hp += @result.hp_drain
      user.mp += @result.mp_drain
    else
      coz_ebishod_gmactr_execute_damage(user, *args)
    end
  end

  [:hp, :mp].each { |stat|
    alias_method("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, "item_effect_recover_#{stat}".to_sym)
    define_method("item_effect_recover_#{stat}".to_sym) { |user, item, effect|
      if $game_party.in_battle
        value = (send("m#{stat}".to_sym) * effect.value1 + effect.value2) * rec
        value *= user.pha if item.is_a?(RPG::Item)
        value = value.to_i
        @result.send("#{stat}_damage=".to_sym, @result.send("#{stat}_damage".to_sym) - value)
        @result.success = true
        send("odometer_#{stat}=".to_sym, send("odometer_#{stat}".to_sym) - value)
      else
        send("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, user, item, effect)     
      end
    }
  }

end

#==============================================================================
# ** Game_Enemy
#==============================================================================

class Game_Enemy

  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.odometer_hp -= @result.hp_drain
    user.odometer_mp -= @result.mp_drain
  end

end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle

  alias coz_ebishod_scbtl_start start
  def start
    coz_ebishod_scbtl_start
    @timerod = 0
  end

  alias coz_ebishod_scbtl_update_basic update_basic
  def update_basic(*args)
    coz_ebishod_scbtl_update_basic(*args)
    update_odometer
  end

  def update_odometer
    $game_party.members.each { |actor|
      if actor.odometer_hp != 0 or actor.odometer_mp != 0
        if actor.odometer_hp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_hp > 0 ? 1 : - 1
          actor.hp -= damage
          actor.odometer_hp -= damage
        end
        if actor.odometer_mp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_mp > 0 ? 1 : - 1
          actor.mp -= damage
          actor.odometer_mp -= damage
        end
        if @timerod == Earthboundish::Odometer_Roll_Speed
          @status_window.refresh
          @timerod = 0
        else
          @timerod += 1
        end
      end
    }
  end

end
 
Last edited:

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
Code:
#==============================================================================
# ** Earthbound-Ish Odometer Roll [Graphical Edit]
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Thread: rmrk.net/index.php?topic=47693.0
# Date: February 17, 2013
# Edit date: October 24, 2020
#==============================================================================
# Edit:
# Removes the odometer graphics. Just drains HP and MP with default gauges.
# Credit the original author (cozziekuns) and follow their terms of use
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to emulate the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3). This
# certain addon addresses the infamous HP/MP scrolling system that made battles
# that much more intense.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================
# [Unneeded] Graphics:
#------------------------------------------------------------------------------
# You must have two Odometer pictures in your Graphics/System folder. One of
# them must be named "Odometer_HP", and the other one must be named
# "Odometer_MP". Obviously, they represent the odometer for HP and MP values,
# respectively
#==============================================================================

#==============================================================================
# ** Cozziekuns
#==============================================================================

module Cozziekuns

  module Earthboundish
  
    Odometer_Roll_Speed = 12 # Smaller speeds are faster than larger speeds.
  
  end

end

include Cozziekuns

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor

  attr_accessor :odometer_hp
  attr_accessor :odometer_mp

  alias coz_ebisohd_gmactr_setup setup
  def setup(actor_id, *args)
    coz_ebisohd_gmactr_setup(actor_id, *args)
    @odometer_hp = 0
    @odometer_mp = 0
  end

  alias coz_ebishod_gmactr_execute_damage execute_damage
  def execute_damage(user, *args)
    if $game_party.in_battle
      on_damage(@result.hp_damage) if @result.hp_damage > 0
      @odometer_hp += @result.hp_damage
      @odometer_mp += @result.mp_damage
      user.hp += @result.hp_drain
      user.mp += @result.mp_drain
    else
      coz_ebishod_gmactr_execute_damage(user, *args)
    end
  end

  [:hp, :mp].each { |stat|
    alias_method("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, "item_effect_recover_#{stat}".to_sym)
    define_method("item_effect_recover_#{stat}".to_sym) { |user, item, effect|
      if $game_party.in_battle
        value = (send("m#{stat}".to_sym) * effect.value1 + effect.value2) * rec
        value *= user.pha if item.is_a?(RPG::Item)
        value = value.to_i
        @result.send("#{stat}_damage=".to_sym, @result.send("#{stat}_damage".to_sym) - value)
        @result.success = true
        send("odometer_#{stat}=".to_sym, send("odometer_#{stat}".to_sym) - value)
      else
        send("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, user, item, effect)     
      end
    }
  }

end

#==============================================================================
# ** Game_Enemy
#==============================================================================

class Game_Enemy

  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.odometer_hp -= @result.hp_drain
    user.odometer_mp -= @result.mp_drain
  end

end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle

  alias coz_ebishod_scbtl_start start
  def start
    coz_ebishod_scbtl_start
    @timerod = 0
  end

  alias coz_ebishod_scbtl_update_basic update_basic
  def update_basic(*args)
    coz_ebishod_scbtl_update_basic(*args)
    update_odometer
  end

  def update_odometer
    $game_party.members.each { |actor|
      if actor.odometer_hp != 0 or actor.odometer_mp != 0
        if actor.odometer_hp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_hp > 0 ? 1 : - 1
          actor.hp -= damage
          actor.odometer_hp -= damage
        end
        if actor.odometer_mp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_mp > 0 ? 1 : - 1
          actor.mp -= damage
          actor.odometer_mp -= damage
        end
        if @timerod == Earthboundish::Odometer_Roll_Speed
          @status_window.refresh
          @timerod = 0
        else
          @timerod += 1
        end
      end
    }
  end

end
Yes, I know this script and it's good. But is it possible to remove the scrolling numbers and keep the classic ho bar?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,647
Reaction score
562
First Language
English
Primarily Uses
RMVXA
But is it possible to remove the scrolling numbers and keep the classic ho bar?
That's what @zeroscares did. The script is modified to not have the scrolling numbers. So you don't need the image files.
It's right in the script
"
# Edit:
# Removes the odometer graphics. Just drains HP and MP with default gauges.
"
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
wish people took time to read messages before getting sassy :p ...
 

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
Code:
#==============================================================================
# ** Earthbound-Ish Odometer Roll [Graphical Edit]
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Thread: rmrk.net/index.php?topic=47693.0
# Date: February 17, 2013
# Edit date: October 24, 2020
#==============================================================================
# Edit:
#------------------------------------------------------------------------------
# Removes the odometer graphics. Just drains HP and MP with default gauges.
# Credit the original author (cozziekuns) and follow their terms of use
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to emulate the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3). This
# certain addon addresses the infamous HP/MP scrolling system that made battles
# that much more intense.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================
# [Unneeded] Graphics:
#------------------------------------------------------------------------------
# You must have two Odometer pictures in your Graphics/System folder. One of
# them must be named "Odometer_HP", and the other one must be named
# "Odometer_MP". Obviously, they represent the odometer for HP and MP values,
# respectively
#==============================================================================

#==============================================================================
# ** Cozziekuns
#==============================================================================

module Cozziekuns

  module Earthboundish
 
    Odometer_Roll_Speed = 12 # Smaller speeds are faster than larger speeds.
 
  end

end

include Cozziekuns

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor

  attr_accessor :odometer_hp
  attr_accessor :odometer_mp

  alias coz_ebisohd_gmactr_setup setup
  def setup(actor_id, *args)
    coz_ebisohd_gmactr_setup(actor_id, *args)
    @odometer_hp = 0
    @odometer_mp = 0
  end

  alias coz_ebishod_gmactr_execute_damage execute_damage
  def execute_damage(user, *args)
    if $game_party.in_battle
      on_damage(@result.hp_damage) if @result.hp_damage > 0
      @odometer_hp += @result.hp_damage
      @odometer_mp += @result.mp_damage
      user.hp += @result.hp_drain
      user.mp += @result.mp_drain
    else
      coz_ebishod_gmactr_execute_damage(user, *args)
    end
  end

  [:hp, :mp].each { |stat|
    alias_method("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, "item_effect_recover_#{stat}".to_sym)
    define_method("item_effect_recover_#{stat}".to_sym) { |user, item, effect|
      if $game_party.in_battle
        value = (send("m#{stat}".to_sym) * effect.value1 + effect.value2) * rec
        value *= user.pha if item.is_a?(RPG::Item)
        value = value.to_i
        @result.send("#{stat}_damage=".to_sym, @result.send("#{stat}_damage".to_sym) - value)
        @result.success = true
        send("odometer_#{stat}=".to_sym, send("odometer_#{stat}".to_sym) - value)
      else
        send("coz_ebishod_gmactr_item_effect_recover_#{stat}".to_sym, user, item, effect)    
      end
    }
  }

end

#==============================================================================
# ** Game_Enemy
#==============================================================================

class Game_Enemy

  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.odometer_hp -= @result.hp_drain
    user.odometer_mp -= @result.mp_drain
  end

end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle

  alias coz_ebishod_scbtl_start start
  def start
    coz_ebishod_scbtl_start
    @timerod = 0
  end

  alias coz_ebishod_scbtl_update_basic update_basic
  def update_basic(*args)
    coz_ebishod_scbtl_update_basic(*args)
    update_odometer
  end

  def update_odometer
    $game_party.members.each { |actor|
      if actor.odometer_hp != 0 or actor.odometer_mp != 0
        if actor.odometer_hp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_hp > 0 ? 1 : - 1
          actor.hp -= damage
          actor.odometer_hp -= damage
        end
        if actor.odometer_mp != 0 and Graphics.frame_count % Earthboundish::Odometer_Roll_Speed == 0
          damage = actor.odometer_mp > 0 ? 1 : - 1
          actor.mp -= damage
          actor.odometer_mp -= damage
        end
        if @timerod == Earthboundish::Odometer_Roll_Speed
          @status_window.refresh
          @timerod = 0
        else
          @timerod += 1
        end
      end
    }
  end

end

This error pops when a battle starts. I put the script under materials...
 

Attachments

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
This error pops when a battle starts. I put the script under materials...
test the script in a blank game to see if the error stays. this code is for vx ace, not vx.
i put it in a blank project + tested with a battle processing event, works fine
 

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
test the script in a blank game to see if the error stays. this code is for vx ace, not vx.
i put it in a blank project + tested with a battle processing event, works fine
ok, i tried with new game and it works. Thanks to everyone :)
 

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
test the script in a blank game to see if the error stays. this code is for vx ace, not vx.
i put it in a blank project + tested with a battle processing event, works fine
There is an issue:
If I give an item to a died actor, (before it dies) the game crashes the following turn with this error.
 

Attachments

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
There is an issue:
If I give an item to a died actor, (before it dies) the game crashes the following turn with this error.
works fine for me. upload a demo and send it here to show this error
if you have multiple scripts in your game there's probably some incompatibility with it
 

Ina00

Villager
Member
Joined
Oct 10, 2020
Messages
24
Reaction score
0
First Language
Italian
Primarily Uses
RMVX
works fine for me. upload a demo and send it here to show this error
if you have multiple scripts in your game there's probably some incompatibility with it
I only have a script that changes the HP and MP bar graphic. Anyway here the demo.

EDIT: sorry for the language...
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
"I only have a script that changes the HP and MP bar graphic"
You clearly have Title Large Choices, Message Sound, 8 Dir Move, and Syvkal's Menu Bars VXAce installed.

The demo doesn't even set anything up! I had to manually add items to test it, and I got no errors hahaha
Find someone else to fix your errors, not helping anymore
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,647
Reaction score
562
First Language
English
Primarily Uses
RMVXA
The demo doesn't even set anything up!
True, He probably used the troop test battle. As it has one character at level 1 and the other at level 15.
However I also could not repeat the error.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

GOBBLE GOBBLE! Happy thanksgiving.
Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!

Forum statistics

Threads
105,552
Messages
1,014,573
Members
137,225
Latest member
Eryndor
Top