The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: JJ_Legend on January 17, 2006, 06:10:41 AM

Title: A Monster HP Script.
Post by: JJ_Legend on January 17, 2006, 06:10:41 AM
Does any one have a Script where it shows the monsters HP. On the default battle system. I don't need the Side-by-Side Battle system. Just the Default one.

Thanks in advance,

JJ  :)
Title: A Monster HP Script.
Post by: SiR_VaIlHoR on January 17, 2006, 04:32:08 PM
i've make a topic with an item analyser if u're interesting tell me
Title: A Monster HP Script.
Post by: ahref on January 17, 2006, 09:08:12 PM
you mean an add-on to the original script to show the enemy hp..ok

describe where you want it to be positioned and then somebody might be able to help you
Title: A Monster HP Script.
Post by: JJ_Legend on January 17, 2006, 09:17:03 PM
Well, Above the Enemy Would be appropriate. Please
Title: A Monster HP Script.
Post by: ahref on January 17, 2006, 09:19:48 PM
points to sig im learning ruby at the moment i can edit scripts and advise people on how to word there request but i hav no idea yet
Title: A Monster HP Script.
Post by: dwarra on January 17, 2006, 09:28:11 PM
Its below the enemy, but im sure its useful for you.

http://www.rmxp.net/forums/index.php?showtopic=6647&hl=enemy+hp
Title: A Monster HP Script.
Post by: ahref on January 17, 2006, 09:31:37 PM
here we go if you dont have a rmxp account:

someone else made this not me i might edit it to be above the monster but later he....

Ok here's the script read carefully:

in Window_Base add:


def draw_enemy_hp_meter(enemy, x, y, width = 156, type = 0)
 if type == 1 and enemy.hp == 0
   return
 end
 self.contents.font.color = system_color
 self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255)) #0, 0, 0, 255
 self.contents.fill_rect(x, y+28, width * enemy.hp/ enemy.maxhp,4, Color.new(0, 100, 155, 255)) #0, 255, 255, 255
end


Make a new window under window_battlestatus and add:


class Window_EnemyBar < Window_Base
#Thanks to rpgmaker for helping me with the x and y placements.
#--------------------------------------------------------------------------
# ● ã,ªãƒ–ã,¸ã,§ã,¯ãƒˆåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
 super(0, 0, 640, 480)
 self.z = 9998
 self.contents = Bitmap.new(width - 32, height - 32)
 self.contents.font.name = $fontface
 self.contents.font.size = $fontsize
 refresh
end
#--------------------------------------------------------------------------
# ● è§£æ"¾
#--------------------------------------------------------------------------
def dispose
 super
end
#--------------------------------------------------------------------------
# ● リフレッã,·ãƒ¥
#--------------------------------------------------------------------------
def refresh
 self.contents.clear
@item_max = $game_troop.enemies.size
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy = $game_troop.enemies[0]
draw_enemy_hp_meter(enemy, enemy.screen_x - 75, enemy.screen_y - 40, 120)
  self.contents.font.color = brightgray_color
self.contents.draw_text(enemy.screen_x - 90, enemy.screen_y - 25, 100, 32, "HP:")
self.contents.draw_text(enemy.screen_x - 20, enemy.screen_y - 25, 100, 32, enemy.hp.to_s + " /  ")
self.contents.draw_text(enemy.screen_x, enemy.screen_y - 25, 100, 32, " " + enemy.maxhp.to_s)
end
if enemy = $game_troop.enemies[1]
draw_enemy_hp_meter(enemy, enemy.screen_x - 75, enemy.screen_y - 40, 120)
    self.contents.font.color = brightgray_color
  self.contents.draw_text(enemy.screen_x - 90, enemy.screen_y - 25, 100, 32, "HP:")
  self.contents.draw_text(enemy.screen_x - 20, enemy.screen_y - 25, 100, 32, enemy.hp.to_s + " /  ")
self.contents.draw_text(enemy.screen_x, enemy.screen_y - 25, 100, 32, " " + enemy.maxhp.to_s)
end
if enemy = $game_troop.enemies[2]
draw_enemy_hp_meter(enemy, enemy.screen_x - 75, enemy.screen_y - 40, 120)
    self.contents.font.color = brightgray_color
  self.contents.draw_text(enemy.screen_x - 90, enemy.screen_y - 25, 100, 32, "HP:")
  self.contents.draw_text(enemy.screen_x - 20, enemy.screen_y - 25, 100, 32, enemy.hp.to_s + " /  ")
self.contents.draw_text(enemy.screen_x, enemy.screen_y - 25, 100, 32, " " + enemy.maxhp.to_s)
end
end
 
 end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
  end


In Winow_Base where you see the colors defined add:


def brightgray_color
  return Color.new(200, 200, 200, 255)
end


in Scene_Battle 1 (Thanks to rpgmaker for helping me along with this)
add


  @enemy_window = Window_EnemyBar.new
  @enemy_window.opacity = 0
  @enemy_window.back_opacity = 0


in the disposes add:


@enemy_window.dispose


same with the updates add:


@enemy_window.update


Now search for the line


@status_window.refresh


and add:


@enemy_window.refresh


Do this in scene battler 2 (There should only be one)
and 3 in scene battler 4

and that's it.

Any probs let me know.
Title: A Monster HP Script.
Post by: Shinami on January 17, 2006, 10:22:08 PM
Sorry to ask but how does one make the actual script work?
Title: A Monster HP Script.
Post by: ahref on January 17, 2006, 10:26:27 PM
im sorry im drugged up on stuff for my cold ill post them on my previous post
Title: A Monster HP Script.
Post by: JJ_Legend on January 18, 2006, 06:19:50 AM
Thanks Alot.
Title: Problems
Post by: VampireHSS on January 18, 2006, 02:42:47 PM
I've done that and when I try to test the game a message appears saying:
?????'Window_EnemyBar'?50??? SyntaxError ????????
Title: A Monster HP Script.
Post by: JJ_Legend on January 18, 2006, 08:04:18 PM
Indeed, Me too. VampireHSS and Me and Some other people are making a game.
Title: A Monster HP Script.
Post by: ahref on January 18, 2006, 08:06:31 PM
can you give me the line that it is on i may be able to fix it if not i shall post a message to the creator on your behaf
Title: A Monster HP Script.
Post by: VampireHSS on January 18, 2006, 08:38:45 PM
It appears when I try to start the game, it doesn't say anything else, do you want a screenshot from it?
Title: A Monster HP Script.
Post by: jasonorme666 on January 19, 2006, 06:11:22 AM
any chance of a working enemy hp script?
Title: A Monster HP Script.
Post by: dwarra on January 19, 2006, 04:56:30 PM
It does work. Test your game. When you get the error, go to the script editior and find the line. Most chances are its a line with the line $fontsize.

Just change it to 22.
Title: A Monster HP Script.
Post by: VampireHSS on January 19, 2006, 09:05:32 PM
How do I know which of the "categoryes" is the error?
How do I know the line of the error?
Title: A Monster HP Script.
Post by: JJ_Legend on January 20, 2006, 06:25:02 AM
Could you post the script with the enlarged line ? Please
Title: A Monster HP Script.
Post by: VampireHSS on January 29, 2006, 12:02:58 PM
please dwarra
Title: A Monster HP Script.
Post by: JJ_Legend on February 01, 2006, 02:54:37 PM
Can somebody please post this Completed !!!
Title: A Monster HP Script.
Post by: Dalton on February 06, 2006, 03:22:39 AM
Okay! To find your problem do play test, you get the error now go to the script manager and POOF! You're at the errored line.

Now according to how I read your error, you did not follow the instructions of the script, so I suggest you do it properly before complaining again.
Title: A Monster HP Script.
Post by: noian on February 12, 2006, 08:23:42 PM
Edit: It works now except for this line in the script:
bitmap=RPG::Cache.picture("limit_gradient")
Where do I get this?(because it says that it can't find it when I start a battle)
Title: A Monster HP Script.
Post by: Tsunokiette on February 12, 2006, 11:53:58 PM
Quote from: noianEdit: It works now except for this line in the script:
bitmap=RPG::Cache.picture("limit_gradient")
Where do I get this?(because it says that it can't find it when I start a battle)

considering it's called 'limit_gradient' I'm guessing it has absolutely nothing to do with  the monster Hp bar script and has to do with the fact that you didn't get the image from the same place you found the
limit-break/limits/overdrive/etc. script.
Title: A Monster HP Script.
Post by: noian on February 15, 2006, 08:41:06 PM
i can get the bar to show no but can't get the Monster HP words to show