[XP] Battler States

Started by ThallionDarkshine, December 13, 2012, 07:53:47 pm

Previous topic - Next topic

ThallionDarkshine

Battler States
Authors: ThallionDarkshine
Version: 0.1
Type: Battle Add-on
Key Term: Battle Add-on



Introduction

Another script with a quite ambiguous name from me. This script allows users to configure different ranges of health that each have their own custom tag that is added to enemies' names. Actors have these health "states" too, but they are not shown in their names. This is another cool feature from Blizz's game that I really liked because it allows players to see enemies health without giving away actual numbers.


Features


  • Add health "states" to battlers

  • Create different "states" for different ranges of health

  • Show custom tags in enemy names for each "state"




Screenshots

None required, would just be a picture showing a tag like "[Excellent]" in an enemy's name.


Demo

None yet.


Script

Spoiler: ShowHide

class Game_Battler
  attr_reader :state
 
  STATES = [
    [0..6, '[Critical]'],
    [7..36, '[Bad]'],
    [37..65, '[OK]'],
    [66..92, '[Good]'],
    [93..100, '[Excellent]'],
  ]
 
  alias tdks_state_init initialize
  def initialize(*args)
    tdks_state_init(*args)
    @state = Game_Battler::STATES.detect { |i| 100.between?(i[0].first, i[0].last) }[1]
  end
 
  alias tdks_state_hp= hp=
  def hp=(val)
    self.tdks_state_hp=(val)
    percent = (@hp * 100.0 / maxhp).ceil
    @state = Game_Battler::STATES.detect { |i| percent.between?(i[0].first, i[0].last) }[1] unless @hp == 0
  end
end

class Game_Enemy
  alias tdks_state_name name
  def name
    return tdks_state_name + ' ' + @state
  end
end



Instructions

Just paste the script in, configure the states like this:
[HEALTH_RANGE_MIN..HEALTH_RANGE_MAX, TAG_NAME]



Compatibility

I don't think there are any issues.


Credits and Thanks


  • ThallionDarkshine

  • Blizz for making CP




Author's Notes

None

Heretic86

Schweet!

The first things that pop into my head are the ability to "cover" someone with a Low HP State, some form of a "Last Resort" type of powerful attack that can only be used also when HP are in a Low State, and a Full HP attack state.

Tons and tons of scripts from you quite quickly!

QuoteAn Error Has Occurred!
Sorry, you can't repeat a karma action without waiting 2 hours. 
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)