Regen Display

So I want to have a Regen status effect in my game. I added it to the list of statuses in the Database and gave it slip damage. I then went to the script editor and in Game_Battler 3 replaced the line


self.hp -= self.damage


with


if self.state?(18)
      self.hp += self.damage
    else
      self.hp -= self.damage
    end


Where 18 is the ID of Status effect I made. This actually works fine. In battle my character's health goes up. Outside of battle, on the map their health still goes down if they have the effect but rather than figure out how to change that I just removed slip damage from effecting units on the map (poison doesn't even persist after battle in my game). Anyway my actual question regards the text that shows the health change. Right now it's plain white text that indicates damage, even though it is successfully increasing health. I can't seem to find where exactly this text is displayed so I want to know where and how I can change it from white to green.
Bump
😀
Don't have access to the RMXP right now, but you could try to add


self.damage_pop = true


to the process. This property should initialize a damage pop-up in battle.


If the value stored in  self.damage  is positive, the value is always displayed as damage. You may also have to add


self.critical = false


since otherwise it is possible that the damage is displayed as a critical hit when the last action against the target was also critical.
No that didn't work (inserting it into Game_Battler 3 anyway). I tried inserting it after my if statement which cause the regen damage to appear white but all damage after it to appear green for some reason. Trying it in the if statement itself had no effect at all. I should also note that in an attempt to make remedy the situation I have removed the damage pop from scene battler 5 so the visual effects are invisible. I'd rather have a green display but no display is better than a white one.
No that didn't work (inserting it into Game_Battler 3 anyway).



Uh, did you test that in battletest-mode or during regular testplay? You have to save your project before changes in the script editor are considered ingame (which does not happen automatically when running a test battle).
No, I did it during a regular testplay which forces a save before running. It seems for some reason the graphic's manager is registering the change as negative even though it's positive. I've also tried self.hp -= -damage but that doesn't change anything.
Arg... Read over your opening post again and realized I got the question wrong... Sorry. =)


To make text appear in green, the value stored in self.damage has to be negative (it doesn't matter if and how your health has changed). You can achieve that by writing


self.damage = -self.damage


for example.
Ah. Alright. That makes sense, I guess. I've added that and everything seems to be working. Thanks. 🙂


For anyone else who wants to have a regen effect. This is what my entire slip damage method looks like in Game_Battler 3.


 #--------------------------------------------------------------------------
  # * Application of Slip Damage Effects
  #--------------------------------------------------------------------------
  def slip_damage_effect
    # Set damage
    self.damage = self.maxhp / 10
    # Dispersion
    if self.damage.abs > 0
      amp = [self.damage.abs * 15 / 100, 1].max
      self.damage += rand(amp+1) + rand(amp+1) - amp
    end
    # Subtract damage from HP
    if self.state?(18)
      self.damage = -self.damage
    end
    self.hp -= self.damage
    # End Method
    return true
  end


Where 18 is the ID of the state I made to induce regen using the database.

Original thread: https://forums.rpgmakerweb.com/threads/regen-display.60930/