Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Closed TopicStart new topic
> Submission: Enemy HP Window, by Noobitron
jens009
post Jul 6 2008, 03:13 PM
Post #1


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled





Version 01
Author Noobitron
Release Date May 19, 2006


Introduction
I did not create this script but rather reposting it for reproduction purposes.

The script is self explanatory. A window appears on the upper left corner during battle which shows the enemy's current HP status. The script can also be modified further to show the enemy's SP.

Features

Current Bar plug-in uses Slanted bars by SephirothSpawn
Transparent enemy box window.

Script
CODE
# Breath of Fire Enemy window
# By Noobitron
# Slanted Bars by Sephiroth Spawn.

class Window_Base
  # define enemy name
  def draw_enemy_name(enemy, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 120, 32, enemy.name)
  end
  
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    # Draw Border
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    # Draw Background
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end
end

#ENEMY HP WINDOW
class Window_EnemyHP < Window_Base
def initialize
super(0, 0, 160, 106)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end

#REFRESH
def refresh
   self.contents.clear
    for i in 0...$game_troop.enemies.size
      enemy = $game_troop.enemies[i]
        x = 0
        y = i * 25
       draw_slant_bar(x, y + 25, enemy.hp, enemy.maxhp, width = 100, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
            draw_slant_bar(x, y + 30, enemy.sp, enemy.maxsp, width = 100, height = 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
       draw_enemy_name(enemy, x, y)
     end
   end
end

class Scene_Battle
  
  alias queed_update update
  alias queed_update_phase5 update_phase5
  alias queed_update_phase4_step1 update_phase4_step1
  alias queed_update_phase4_step5 update_phase4_step5
  alias queed_start_skill_select start_skill_select
  alias queed_end_skill_select end_skill_select
  alias queed_start_item_select start_item_select
  alias queed_end_item_select end_item_select
  
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    @enemy_window = Window_EnemyHP.new
    @enemy_window.z = 255

    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    @enemy_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of sprite set
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  
  def update
    @enemy_window.update
    queed_update
end

  def start_skill_select
    queed_start_skill_select
    @enemy_window.visible = false
  end

    def end_skill_select
     queed_end_skill_select
     @enemy_window.visible = true
    end

    def start_item_select
      queed_start_item_select
      @enemy_window.visible = false
    end
    
    def end_item_select
      queed_end_item_select
      @enemy_window.visible = true
    end
    
  def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
        @enemy_window.visible = false
        # Show result window
        @result_window.visible = true
        # Clear main phase flag
        $game_temp.battle_main_phase = false
        # Refresh status window
        @status_window.refresh
        @enemy_window.refresh
      end
      return
    end
queed_update_phase5
end

def update_phase4_step1
  queed_update_phase4_step1
  @enemy_window.refresh
end

  def update_phase4_step5
    # Hide help window
    @help_window.visible = false
    # Refresh status window
    @status_window.refresh
    @enemy_window.refresh
    queed_update_phase4_step5
  end
end

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # * Set Level Up Flag
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def level_up(actor_index)

    @level_up_flags[actor_index] = true
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
      draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, actor_x, 96)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Slightly lower opacity level during main phase
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
  end
end



Customization
Changing the colors of enemy's HP
Refer to line 58. You can change the initial color and ending color
Adding the SP Bar
Add this line below line 58.
draw_slant_bar(x, y + 30, enemy.sp, enemy.maxsp, width = 100, height = 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
Changing the coordinates of the bar
Look at lines 51-60. I don't want to go in depth but play around with the x and y coordinates.
Make the window non-transparent
Refer to line 47.
Change
self.opacity = 0
to
self.opacity = 255

Compatibility

The only compatible issue I see is that this might conflict SOME battle systems. because it modifies Scene_Battle. No worries though, the modification were aliased. However, if you are using some sort of weird battle system that modified Scene_Battle completely, then there might be some issues. ;-]

Regardless, it should be compatible with popular battle add-ons such as Minkoff's Animated Battlers. So no worries.


Screenshot
Since you want it so bad.



DEMO
N/A

Installation
Plug and Play.

Enjoy. =]

FAQ
Help! I want to change mee bars./ I'm-the-kinda-guy-who-likes-using-bar-images-or-some-other-weird-bars
I keep refering to line 58. Just change that to the template of your new bar system

For other facts see customization above.

Terms and Conditions

Give Credit to Noobitron and Sephiroth Spawn

Credits
Noobitron
SephirothSpawn


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Redd
post Jul 7 2008, 02:38 PM
Post #2


:<
Group Icon

Group: Revolutionary
Posts: 2,310
Type: Developer
RM Skill: Advanced




O O
< wow.... That is freaking awesome. If there are any battles in my game, i am definetely going to put this in there!
___


__________________________
Go to the top of the page
 
+Quote Post
   
peterboi
post Jul 7 2008, 03:52 PM
Post #3


Level 3
Group Icon

Group: Member
Posts: 32
Type: None
RM Skill: Beginner




messes up my minkoff's animated battler and just shows hp of actors and enemy but nothing happens :\


__________________________
Need Minkoffs Battler Sprites? Got Templates But Don't Know What To Do? Click Here!
Go to the top of the page
 
+Quote Post
   
jens009
post Jul 7 2008, 05:23 PM
Post #4


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




QUOTE (peterboi @ Jul 7 2008, 04:06 PM) *
messes up my minkoff's animated battler and just shows hp of actors and enemy but nothing happens :\


It's suppose to show hp and sp of actors and enemy

What do you mean by it messes up your animated battler?


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
peterboi
post Jul 7 2008, 05:28 PM
Post #5


Level 3
Group Icon

Group: Member
Posts: 32
Type: None
RM Skill: Beginner




thats all it shows the names and hp and sp bars. and the battle them is still going on
and no battlers come out and the menu dun even appear


__________________________
Need Minkoffs Battler Sprites? Got Templates But Don't Know What To Do? Click Here!
Go to the top of the page
 
+Quote Post
   
Twilight27
post Jul 7 2008, 06:14 PM
Post #6


Level 19
Group Icon

Group: Revolutionary
Posts: 371
Type: Event Designer
RM Skill: Beginner




Is it possible for you to script this for VX, jens?


__________________________

Fall to the power of the Emo!
We have cookies!


Notice!! Check out my topic (http://www.rpgrevolution.com/forums/index.php?showtopic=45736&st=0#entry454175) if you're interested in helping me make a script that limits the number of characters & items you use in battle AND also an item durability feature! Thanks for any help in advance!
Go to the top of the page
 
+Quote Post
   
jens009
post Jul 7 2008, 07:00 PM
Post #7


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




QUOTE (Twilight27 @ Jul 7 2008, 06:28 PM) *
Is it possible for you to script this for VX, jens?

It's possible to script it but I'm not sure if I can do it simply because RMVX has new methods, which of course I'm not very familiar with.
However, the same rules will still apply. So a VX scripter can use this script and translate it.

@Peterboi: I'll try to test it and see what you mean.

Peter, I do not know what you are talking about since I just tested the system on Dervvulfman's 10.5 Demo version

Here's a screenie for proof:

Are you sure you're not using the illegal version of rmxp?


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
peterboi
post Jul 7 2008, 08:43 PM
Post #8


Level 3
Group Icon

Group: Member
Posts: 32
Type: None
RM Skill: Beginner




not sure what u mean about illegal i got this from a friend :\
so i guess mines illegal? and this script wont work?

EDIT: nope i downloaded it from this site and it works
http://tkool.jp/products/rpgxp/eng/download.html

EDIT: any of these scripts can make this script not to work?


EDIT: ok... it works fine with the demo.. :\

EDIT: OK i found the problem it ISNT compatiable with SDK by sephiroth :\

This post has been edited by peterboi: Jul 7 2008, 10:00 PM


__________________________
Need Minkoffs Battler Sprites? Got Templates But Don't Know What To Do? Click Here!
Go to the top of the page
 
+Quote Post
   
Twilight27
post Jul 8 2008, 04:07 AM
Post #9


Level 19
Group Icon

Group: Revolutionary
Posts: 371
Type: Event Designer
RM Skill: Beginner




QUOTE (jens009 @ Jul 7 2008, 10:14 PM) *
QUOTE (Twilight27 @ Jul 7 2008, 06:28 PM) *
Is it possible for you to script this for VX, jens?

It's possible to script it but I'm not sure if I can do it simply because RMVX has new methods, which of course I'm not very familiar with.
However, the same rules will still apply. So a VX scripter can use this script and translate it.

@Peterboi: I'll try to test it and see what you mean.

Peter, I do not know what you are talking about since I just tested the system on Dervvulfman's 10.5 Demo version

Here's a screenie for proof:

Are you sure you're not using the illegal version of rmxp?


So...can anybody script this for VX?
Or, um jens, do you think it's possible say: If you obtain a special item in the game (to equip possibly) only then can you see their life bar and such???


__________________________

Fall to the power of the Emo!
We have cookies!


Notice!! Check out my topic (http://www.rpgrevolution.com/forums/index.php?showtopic=45736&st=0#entry454175) if you're interested in helping me make a script that limits the number of characters & items you use in battle AND also an item durability feature! Thanks for any help in advance!
Go to the top of the page
 
+Quote Post
   
jens009
post Jul 8 2008, 05:36 PM
Post #10


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Yes. That's possible.
All you have to do is add an if statement before the script shows the enemy's window to check if the equipment is present.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Harkness
post Jan 6 2009, 02:14 PM
Post #11


Level 7
Group Icon

Group: Member
Posts: 91
Type: None
RM Skill: Beginner




Hey, uh, jens009,
I hope i'm not necroposting, but do you know if this is compatable with XRX's FMBS? you said it was compatible with Mankoff's animated battlers but i'm not sure...
Go to the top of the page
 
+Quote Post
   
jens009
post Jan 11 2009, 08:59 AM
Post #12


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




QUOTE (Harkness @ Jan 6 2009, 02:14 PM) *
Hey, uh, jens009,
I hope i'm not necroposting, but do you know if this is compatable with XRX's FMBS? you said it was compatible with Mankoff's animated battlers but i'm not sure...

Erm. I'm not sure if it's compatible with that battle system.
But this is just an extra window that shows up during the battle. It's possible to modify the script to fit into any battle system.
Try it out first. If it doesn't fit with the battle system, link me to XRX's FMBS and I'll fix the problem.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
ozer
post Jan 11 2009, 09:50 AM
Post #13


Level 6
Group Icon

Group: Member
Posts: 89
Type: Developer
RM Skill: Skilled




Thank you, very nice script works great.


__________________________

Current projects:
Terrificare, Survial horror game Complete http://www.mediafire.com/?yy46r7ofaqgfafc
Terrificare 2, about 40% complete.
Terrificare 3, Not started.
Go to the top of the page
 
+Quote Post
   
rgalaxy
post Jan 26 2009, 04:25 AM
Post #14


Level 2
Group Icon

Group: Member
Posts: 15
Type: Musician
RM Skill: Undisclosed




excuse me jens... i look your scriptt is really great, so i try and attach it to my prject..
but after i try to play it...
i find that the bar is just for 2 monsters..

and when i battle with 8 monsters, the hp and sp car is not shown.. why that's happen?


<hope i not necro posting>



please help me jens... ^^
Go to the top of the page
 
+Quote Post
   
jens009
post Feb 1 2009, 11:12 AM
Post #15


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Hi. Thanks for that.
Look for these lines:
CODE
class Window_EnemyHP < Window_Base
def initialize
super(0, 0, 160, 106)


change the line that starts with super to:
CODE
super(0, 0, 160, 480)

It should work for all monsters after doing that

Also, the script is not by me, it was made by noobitron. =]


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Zeffa
post Oct 9 2009, 11:24 AM
Post #16


Level 8
Group Icon

Group: Revolutionary
Posts: 130
Type: Artist
RM Skill: Intermediate




Very nice lil script, I'm after some sort of HP/SP image, so... Sorry if I'm being completely noobish here but, I'm not great at the coding part of RM yet.

I'm not sure where I'm suppose to put this code. I have Scene_Battle 1-4, these have been unmodified as of yet.

I've scanned through the whole post a couple of times couldn't find anything and I even tried to pop the code in a few places myself.

Sorry again and thanks, much appreciated!


__________________________
Illustrator/GraphicDesigner, if you want somert... Like an illustration or a logo? Just ask! (Nothing too crazy though) ;)
For the love, the art, the game, the metal and the sex... And thanks for the freebies.


Out Now!
Awaiting reviews and feedback.

Current Project: Exodus: Escape Fort Bullwark
Engine: RMXP
Completion: Chapter One, 100%
Release Date: Out now, Winter 2009
Download Link: Via MediaFire

Exodus Full Game Thread
Exodus Forum Topic
Exodus Screen Gallery
Go to the top of the page
 
+Quote Post
   
yamina-chan
post Oct 9 2009, 12:24 PM
Post #17


Level 8
Group Icon

Group: Revolutionary
Posts: 128
Type: None
RM Skill: Skilled




QUOTE (Zeffa @ Oct 9 2009, 09:24 PM) *
Very nice lil script, I'm after some sort of HP/SP image, so... Sorry if I'm being completely noobish here but, I'm not great at the coding part of RM yet.

I'm not sure where I'm suppose to put this code. I have Scene_Battle 1-4, these have been unmodified as of yet.

I've scanned through the whole post a couple of times couldn't find anything and I even tried to pop the code in a few places myself.

Sorry again and thanks, much appreciated!



I hope I got you right there, but if I am not mistaken, you can add it just above the "MAIN" script. Name it what ever you want and copy-paste the script and everything should be fine ^^
I tryed it, so it should work.
If I misunderstood the question...well, then I'm sorry for the spam ^^'


__________________________
There is a game out there for everyone. All you have to do is to find it.
Go to the top of the page
 
+Quote Post
   
Zeffa
post Oct 9 2009, 01:26 PM
Post #18


Level 8
Group Icon

Group: Revolutionary
Posts: 130
Type: Artist
RM Skill: Intermediate




Yeah sorry, you did understand me right. I can go off on one sometimes, and come across a little vague.

So anyway, yeah I tried that but it didn't work. Not to worry now though, I managed to get another HP/SP image script working.

Thanks x

This post has been edited by Zeffa: Oct 9 2009, 01:27 PM


__________________________
Illustrator/GraphicDesigner, if you want somert... Like an illustration or a logo? Just ask! (Nothing too crazy though) ;)
For the love, the art, the game, the metal and the sex... And thanks for the freebies.


Out Now!
Awaiting reviews and feedback.

Current Project: Exodus: Escape Fort Bullwark
Engine: RMXP
Completion: Chapter One, 100%
Release Date: Out now, Winter 2009
Download Link: Via MediaFire

Exodus Full Game Thread
Exodus Forum Topic
Exodus Screen Gallery
Go to the top of the page
 
+Quote Post
   
crimson_plague10...
post Nov 16 2009, 11:13 PM
Post #19


Level 2
Group Icon

Group: Member
Posts: 22
Type: Developer
RM Skill: Beginner




hey just to let you know it conflicts with blizzards easy lvl up notifier
Go to the top of the page
 
+Quote Post
   
Bluestraza
post Jan 12 2010, 12:18 PM
Post #20


Level 4
Group Icon

Group: Member
Posts: 48
Type: Developer
RM Skill: Intermediate




is there any way to make the enemy bars show more than jus 2 monsters at a time? also, is it possible to make the dead monsters' hp bars disappear when they die?


__________________________
Dark Infinite - 1% completed
Game Features:
Unique party members - Whatever you do in the story could effect what Team members you can get later on.
Animated side-view battle system
Gear requirements
Complete control over character growth - Customize stats any way you want! [SCRAPPED]
Special weapon skills - certain weapons have their own abilities
Totally immersive story
Quests and achievements
Probably some voice acting. we'll see how things go.
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 09:46 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker