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.

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

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

Demo

Nah, no use right?

Script

Code:
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


Code:
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

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
 
Actually there is a problem with your alias, you used the wrong method name it should have been this

Code:
alias da2dbm_hp= hp=

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
Code:
self.da2dbm_hp=(hp)

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.
 
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.
 

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