RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RMXP] Enemy Life Bar Script (Be Repair) will repost when fixed.

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 76
RMRK Junior
This is the Enemy Life bar script, it dont work by itself, working on the problem, asap. will post when done, thanks for waiting
Spoiler for:
class Window_Base < Window 
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)<----Credit Them
  #--------------------------------------------------------------------------
  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


class Window_EnemyHP < Window_Base
 
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    for i in 0...$game_troop.enemies.size
      @enemy = $game_troop.enemies
      @percent = (@enemy.hp * 100) / @enemy.maxhp
      unless @enemy.hp == 0
      draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
      self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
    end
  end
end
end
 
class Scene_Battle
 
  alias raz_update update
  alias raz_update_phase5 update_phase5
  alias raz_update_phase4_step1 update_phase4_step1
  alias raz_update_phase4_step5 update_phase4_step5
  alias raz_enemy_hp_main main
 
   def main
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @enemy_window = Window_EnemyHP.new
    @enemy_window.z = 95
    raz_enemy_hp_main
    @enemy_window.dispose
  end
 
  def update
    @enemy_window.update
    raz_update
  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
   raz_update_phase5
 end

def update_phase4_step1
  raz_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
    raz_update_phase4_step5
  end
end
« Last Edit: August 09, 2010, 03:18:15 AM by Cedricsawall2 »
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

***
Rep:
Level 83
Kidfox70. It happens.
Hm. I tryed this out and it didn't work. It gives an error about line 46. It says there is no method for 'hp'. Also, as just a note or so, you should read the stickied topic about posting Scripts. It would be really helpful if you gave some info. Who wrote the script, what it does, why is it useful, and you should probably post some screen shoots. Oh and how to use it would be nice. Some peopel may not know how to use scripts and heck, I might be doing it wrong. I put it in a new page in the editor (Above main) and and tried doing a Battle. Hope you can tell me what's going down and hopefully I pointed  you in the right direction with posting scripts. :)
I don't say bless you when people sneeze, cause i'm not God. Blessing people is his job. Lolo?

***
Rep:
Level 76
RMRK Junior
Hm. I tryed this out and it didn't work. It gives an error about line 46. It says there is no method for 'hp'. Also, as just a note or so, you should read the stickied topic about posting Scripts. It would be really helpful if you gave some info. Who wrote the script, what it does, why is it useful, and you should probably post some screen shoots. Oh and how to use it would be nice. Some peopel may not know how to use scripts and heck, I might be doing it wrong. I put it in a new page in the editor (Above main) and and tried doing a Battle. Hope you can tell me what's going down and hopefully I pointed  you in the right direction with posting scripts. :)

 i think i know what the problem was, i think you also need to have the life bar script that I have also, so Ill check it out and fix it when i know whats up.
Now Your nightmare comes to life.

[RMXP] CRYSTaL KNigHTS: The First Dawn - 20%
[RMXP] White Ruins - 10 %

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Use a code box, BB Code gets in the way.

Code: [Select]
class Window_Base < Window 
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)<----Credit Them
  #--------------------------------------------------------------------------
  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


class Window_EnemyHP < Window_Base
 
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    for i in 0...$game_troop.enemies.size
      @enemy = $game_troop.enemies[i]
      @percent = (@enemy.hp * 100) / @enemy.maxhp
      unless @enemy.hp == 0
      draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
      self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%")
    end
  end
end
end
 
class Scene_Battle
 
  alias raz_update update
  alias raz_update_phase5 update_phase5
  alias raz_update_phase4_step1 update_phase4_step1
  alias raz_update_phase4_step5 update_phase4_step5
  alias raz_enemy_hp_main main
 
   def main
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    @enemy_window = Window_EnemyHP.new
    @enemy_window.z = 95
    raz_enemy_hp_main
    @enemy_window.dispose
  end
 
  def update
    @enemy_window.update
    raz_update
  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
   raz_update_phase5
 end

def update_phase4_step1
  raz_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
    raz_update_phase4_step5
  end
end

Should work. The problem probably was, [.i] (without the dot) is Italics in BB Code.

***
Rep:
Level 83
Kidfox70. It happens.
You know it worked. I thought it was something to do with that. But I kept thinking it was something like. I had a script like, I had to change ever ... to . . .
If that makes since...haha, it's hard to explain. But yeah cozziekuns was right on spot! Even though, you really should think about edititng this topic, again just a suggestion. :D
I don't say bless you when people sneeze, cause i'm not God. Blessing people is his job. Lolo?

***
herp derp
Rep:
Level 81
Newclear Bomb
Oi im the one who asked. Thanks man