Injured Status

Injured Status
Version: 1.02

Introduction

So, I requested this awhile ago, and being the impatient little bitch that I am... ;) I couldn't help but figure it out myself. Basically, it adds a status (injured, for example) once your battler's hp gets to 25% or lower. Hopefully someone might find this useful as well.

Edit- Now the injured state is crisis_color!


Screenshots

Show Screenshot Spoiler
http://img154.imageshack.us/img154/7043/injuredre8.png[/IMG]


Demo

Nah, no use right?

Script

Game_Battler 1 Spoiler
def hp=(hp)
    @hp = [[hp, maxhp].min, 0].max
    # Da2dbm injured state
        if self.hp <= self.maxhp / 4
          add_state(2) # change number to whatever state you want
        else
          remove_state(2) # use same number two lines up
        end
    # add or exclude incapacitation
    for i in 1...$data_states.size
      if $data_states[i].zero_hp
        if self.dead?
          add_state(i)
        else
          remove_state(i)
        end
      end
    end
  end
Expand to see the code.



Window Base Spoiler
def draw_actor_state(actor, x, y, width = 120)
    text = make_battler_state_text(actor, width, true)
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_text(x, y, width, 32, text)
  end
Expand to see the code.


Instructions
Find Appropriate Classes at the top of your scripts
Find Appropriate Methods
Replace the original methods with my methods
Create whatever status you'd like, and change the number in my script to the number your "injured" status is.

FAQ

Quite easy really.

Compatibility

There was a problem with my alias, because I suck at them -_-. However, there really shouldn't be any compatibility issues...

Credits and Thanks

Da2DBM's limited patience :P
I have a great idea of how to use this. Thanks for posting it! :D
you're welcome, by the way there was small little mistake i just found out cygnea, but now it's fixed
Actually there is a problem with your alias, you used the wrong method name it should have been this

alias da2dbm_hp= hp=
Expand to see the code.


and then when calling the new method it should be called like this so it knows that you are calling the method da2dbm_hp= instead of setting the local variable da2dbm_hp= to a value
self.da2dbm_hp=(hp)
Expand to see the code.


And well your code's indentation is messy.
Thanks for the feedback Seph. Sorry about the messy indentation, i fixed it up a bit...but when i put the equal sign on my alias it gives a syntax error... I've tested my original code too and it works... I'm not sure what I'm doing wrong :-/

Edit- I suck at aliases, if someone could help me do it the right way, I'd appreciate it alot.
If you want to still use this, follow the new instructions I have in the first post.
I updated the script too. I suppose it's what I get for having little patience lol
I added a quick little add-on to window base. Now the injured state is in a yellow color or whatever you defined crisis_color as in your system.
you can do this with common event...
(make you happy now Seph?)
NGGames, please stop with these kind of replies that do not contribute to topics, especially in topics that are a month old.

This is by no means the first time that  I have noticed you.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=9050