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.
Supersimple Head-Up Display

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
I am yourself!
This is my first script posted here, so give me comment or something, ok?

Code: [Select]
#====================================================================
# Supersimple Head-Up Display
#-----------------------------------------------------------------
# ** Version 1.0
# ** Original by Sthrattoff
#====================================================================

# Description :
# This script will allow you to show a HUD window on your map.

# Instruction :
# Put this script above main

# How to Use?
# To call, use Call Script :
# Call Script : $window = Window_HUD.new(game_party_id(0-3))
# To remove, use this
# Call Script : $window.dispose
# For RMXP - PK : "Add self.contents.font.name and font.size by yourself"

#==============================================
# Modification to Window_Base
#==============================================

class Window_Base < Window
 
  def draw_actor_face(actor, x, y)
    bitmap = RPG::Cache.picture(actor.name)
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 96, 96))
  end

  def draw_actor_hpbar(actor, x, y, w = 120)
    # Defines actor hp and maxhp
    vitality = actor.hp
    maxvitality = actor.maxhp
    # Defines color used on bar
    bordercolor = system_color
    outercolor = Color.new(220, 10, 0, 255)
    midcolor = Color.new(220, 35, 0, 255)
    innercolor = Color.new(220, 60, 0, 255)
    emptycolor = Color.new(0, 0, 0, 255)
    # Defines length of bar
    linewidth = (((vitality * 1.0) / maxvitality) * (w - 2))
    emptywidth = ((w - 1) - linewidth)
    emptyx = ((x + 1) + linewidth)
    # Drawing line and border
    borderup = Rect.new(x, y, w, 1)
    borderleft = Rect.new(x, y + 1, 1, 6)
    borderdown = Rect.new(x, y + 7, w, 1)
    borderright = Rect.new(x + w - 1, y + 1, 1, 6)
    emptyline = Rect.new(x + 1, y + 1, w - 2, 6)
    outerline = Rect.new(x + 1, y + 1, linewidth, 6)
    midline = Rect.new(x + 2, y + 2, linewidth - 2, 4)
    innerline = Rect.new(x + 3, y + 3, linewidth - 4, 2)
    # Coloring the bar
    self.contents.fill_rect(borderup, bordercolor)
    self.contents.fill_rect(borderleft, bordercolor)
    self.contents.fill_rect(borderdown, bordercolor)
    self.contents.fill_rect(borderright, bordercolor)
    self.contents.fill_rect(emptyline, emptycolor)
    self.contents.fill_rect(outerline, outercolor)
    self.contents.fill_rect(midline, midcolor)
    self.contents.fill_rect(innerline, innercolor)
  end

  def draw_actor_spbar(actor, x, y, w = 200)
    # Defines actor sp and maxsp
    force = actor.sp
    maxforce = actor.maxsp
    # Defines color used on bar
    bordercolor = system_color
    outercolor = Color.new(0, 110, 180, 255)
    midcolor = Color.new(0, 135, 180, 255)
    innercolor = Color.new(0, 160, 180, 255)
    emptycolor = Color.new(0, 0, 0, 255)
    # Defines length of bar
    linewidth = (((force * 1.0) / maxforce) * (w - 2))
    emptywidth = ((w - 1) - linewidth)
    emptyx = ((x + 1) + linewidth)
    # Drawing line and border
    borderup = Rect.new(x, y, w, 1)
    borderleft = Rect.new(x, y + 1, 1, 6)
    borderdown = Rect.new(x, y + 7, w, 1)
    borderright = Rect.new(x + w - 1, y + 1, 1, 6)
    emptyline = Rect.new(x + 1, y + 1, w - 2, 6)
    outerline = Rect.new(x + 1, y + 1, linewidth, 6)
    midline = Rect.new(x + 2, y + 2, linewidth - 2, 4)
    innerline = Rect.new(x + 3, y + 3, linewidth - 4, 2)
    # Coloring the bar
    self.contents.fill_rect(borderup, bordercolor)
    self.contents.fill_rect(borderleft, bordercolor)
    self.contents.fill_rect(borderdown, bordercolor)
    self.contents.fill_rect(borderright, bordercolor)
    self.contents.fill_rect(emptyline, emptycolor)
    self.contents.fill_rect(outerline, outercolor)
    self.contents.fill_rect(midline, midcolor)
    self.contents.fill_rect(innerline, innercolor)
  end

end

#==============================================
# Window_HUD
#==============================================

class Window_HUD < Window_Base

  def initialize(actor)
    super(0, 0, 160, 128)
    self.contents = Bitmap.new(width - 32, height - 32)
    @index = actor
    refresh
  end

  def refresh
    self.contents.clear
    @actor = $game_party.actors[@index]
    draw_actor_face(@actor, 0, 0)
    draw_actor_name(@actor, 108, 0)
    draw_actor_hpbar(@actor, 108, 32 + 16, 52)
    draw_actor_hp(@actor, 108, 32)
    draw_actor_spbar(@actor, 108, 64 + 16, 52)
    draw_actor_sp(@actor, 108, 64)
    draw_actor_level(@actor, 0, 128)
    draw_actor_class(@actor, 64, 128)
  end

  def change
    refresh
  end

end

Don't forget to post any bugs...
« Last Edit: December 31, 2006, 11:53:55 AM by Sthrattoff »
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
im gona try it out now.. give me a  few to put it in...

ok... i got a syntax error... dunno why...
« Last Edit: December 30, 2006, 03:04:41 AM by feildmaster »
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

***
Rep:
Level 88
Random-Idiot
Screenhot ?  :lol:
ALL HAIL ME™

*****
Ancient Mummy
Rep:
Level 90
:p would be nice lol.
What does it do exactly >.< lol

« Last Edit: December 30, 2006, 05:55:28 PM by Snailer »

***
Rep:
Level 89
I am yourself!
Can you tell me which line or the error message?
Oh, I've updated my script. Just copy paste on first post...
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

*****
<3
Rep:
Level 90
:p would be nice lol.
What does it do exactly >.< lol

How I explain HUD's are they show a characters characteristics on the screen. Examples: Kingdom Hearts 1 and 2, Devil May Cry, Ragnarok Online, Maple Story, ROSE Online, WoW, Trickster and basically most MMORPGs.

~Winged




***
Rep:
Level 89
I am yourself!
Hello anybody...
Does that script work?

I need some evaluation on my skill :
-> Create a script without testing at RMXP...
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
I'LL GIVE IT A SHOT!

Edit when done.

EDIT: Same problem, a syntax error. Thing is, it woun't say where, throws me up at the beggining of Game_Temp. Good luck with this man.
« Last Edit: January 04, 2007, 12:56:19 AM by arrowone »