Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to change damage pop color?

This question should be really easy to answer, I hope someone can help me with this. I'm trying to figure out where in the rpg maker xp's scripts it tells the damage that pops up to be white when its damage, and green when its a heal. I've made a zombie state that turns heals into damage, and it works just fine except when a battler takes damage from heals, the damage pop still shows up as green instead of white. I could leave it like that but it's very confusing, and I'd like to change it so that damage from heals turns up as white too, but I can't for the life of me figure out where in the heck the scripts actually "set" the damage text to white/green. I've been looking all night, and I've searched for things like font.color, bitmap.font, damage_pop, ect. All I need to know is what I should be looking for/where in the script the damage pop color is set, then I know how to script the if/then/else part to check for zombie state. Please let me know, and thanks in advance.
 
RMXP actually hides some of the inbuilt classes; some are written in native code, others are just hidden for some other reason. The class you're referring to is within RPG::Sprite, which you can find by opening up the Help window from the Script Editor and searching RPG::Sprite.

If you scroll down, you'll find a big wall of RGSS; the code you're looking for is in there, under
def damage(value, critical)
 
Thanks for the reply. I found what you're talking about, under RPG::Sprite definition in the help menu of the script editor, I scrolled down where I found this snippet of code that looks to be what I'm looking for:

Code:
      if value.is_a?(Numeric) and value < 0

        bitmap.font.color.set(176, 255, 144)

      else

        bitmap.font.color.set(255, 255, 255)

      end

But I can't figure out how to edit it. I tried copying the entire definition script from the help menu to the script editor as a separate script above main and below my custom scripts, but when I change the top bitmap.font.color.set from (176, 255, 144) to (255, 255, 255), healing still shows up as green so it doesn't seem like editing it that way is working. I searched my scripts and the only place where this snippet of script exists in my custom scripts is in a script that handles a doom status, but it doesn't effect regular damage pops, so I don't think any of my custom scripts are overwriting this part of the script.

Basically what I think I need to do is this:

Code:
      

if value.is_a?(Numeric) and value < 0

  if @states.include?(18) #zombie state

    bitmap.font.color.set(255, 255, 255)

  else

    bitmap.font.color.set(176, 255, 144)

  end

else

bitmap.font.color.set(255, 255, 255)

end

I just need to know "where" exactly I can edit this part of the script to make it work.
 
You need to override the internal script. Copy the entire RPG::Sprite script and place it above main, and make your changes.
You can't access @states from within RPG:Sprite, so you may need to add another flag to damage() or find some other way to achieve it.
 
I think you'll find that changing damage() isn't what you should be doing. I think you should change how is called.

RPG::Sprite#damage is called from Sprite_Battler, on like 110. Rather than having it call
damage(@battler.damage, @battler.critical)

perhaps get it to do the conditional testing there instead.

You can access a battler's states from there easily, using
@battler.state?(state_id)


If you don't want to show it as green, the damage needs to be passed as a positive number. I'm not entirely sure how the colors work off the top of my head (because that would mean none of this is needed, if the actor does actually take damage as a positive number, why would it be green if a positive number is passed because the actor did indeed take damage?)

Hopefully this helps you out a bit.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top