Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Submission: Simple HUD v1.1, Author: Kendorei, the noob scripter. ^_^
Kendorei
post Jan 4 2009, 11:11 PM
Post #1


Level 2
Group Icon

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Intermediate




Version 1.1
Author: Kendorei
Released: 1/8/09

Exclusive to RPG RPG Revolution. (Not that it's difficult to make. happy.gif)

The script is just a simple HUD that can be easily adjusted and used without having to use a CBS.
It's easy to change what it shows in it, and can be used with an in-game Switch and Variable.

Features of the standard script:
1.) Shows the actor's Sprite
2.) Shows the actor's current and max HP
3.) Shows the actor's current and max SP
4.) Shows the actor's current EXP and the EXP required for Level-Up
5.) Shows the actor's Level
6.) Shows the actor's Class
7.) Shows the party's current amount of Gold
8.) Shows the actor's Name
9.) Can be turned on and off via an in-game Switch
10.) Can change which actor is displayed via an in-game Variable
11.) Can show a blank HUD window for an invalid variable (like an empty party slot).

[Show/Hide] Simple HUD Script
CODE
#-------------------------------------------------------------------------------
# Simple HUD (Heads-Up Display) v1.1
#-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
# Created by Kendorei
#-------------------------------------------------------------------------------

class Window_HUD < Window_Base
attr_accessor :actor
def initialize
super(0, 0, 160, 189)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 160 # This makes the HUD transparent
self.visible = $game_switches[1] # This toggles the HUD via a switch
@hud_variable = $game_variables[1] # This variable controls which party member is viewed
@actor = $game_party.actors[@hud_variable] # This makes the HUD display the actor in the corresponding party slot
if (@actor != nil)
@name = @actor.name # Actor's name
@class_name = @actor.class_name # Actor's class
@hp = @actor.hp # Actor's current HP
@maxhp = @actor.maxhp # Actor's max HP
@sp = @actor.sp # Actor's current SP
@maxsp = @actor.maxsp # Actor's max SP
@exp = @actor.exp # Actor's current exp
@nexp = @actor.next_exp_s # The exp required for a level-up
@level = @actor.level # Actor's current level
@gold = $game_party.gold # The amount of gold currently in possession
refresh
else
@gold = $game_party.gold # The amount of gold currently in possession
no_actor
end
end
#-------------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(40, 0, 80, 25, @name.to_s)
self.contents.draw_text(50, 25, 70, 20, @class_name.to_s)
self.contents.draw_text(50, 45, 70, 20, "HP: "+@hp.to_s+"/"+@maxhp.to_s)
self.contents.draw_text(50, 65, 70, 20, "SP: "+@sp.to_s+"/"+@maxsp.to_s)
self.contents.draw_text(50, 85, 70, 20, "EXP: "+@exp.to_s+"/"+@nexp.to_s)
self.contents.draw_text(50, 105, 70, 20, "Lvl "+@level.to_s)
self.contents.draw_text(40, 125, 80, 20, "Gold: "+@gold.to_s)
draw_actor_graphic(@actor, 10, 50)
end
#-------------------------------------------------------------------------------
def no_actor
self.contents.clear
self.contents.draw_text(30, 65, 65, 40, "Empty Slot")
self.contents.draw_text(40, 125, 80, 20, "Gold: "+@gold.to_s)
end
#-------------------------------------------------------------------------------
def update
if (@actor == nil)
self.visible = $game_switches[1]
@hud_variable = $game_variables[1]
@gold = $game_party.gold
no_actor
elsif (self.visible != $game_switches[1]) or
(@hud_variable != $game_variables[1]) or
(@class_name != @actor.class_name) or
(@hp != @actor.hp) or
(@maxhp != @actor.maxhp) or
(@sp != @actor.sp) or
(@maxsp != @actor.maxsp) or
(@exp != @actor.exp) or
(@level != @actor.level) or
(@gold != $game_party.gold)
self.visible = $game_switches[1] # This makes the HUD visible or invisible
@hud_variable = $game_variables[1] # This variable controls which party member is viewed
@actor = $game_party.actors[@hud_variable]
if (@actor != nil)
@name = @actor.name # Actor's name
@class_name = @actor.class_name # Actor's class
@hp = @actor.hp # Actor's current HP
@maxhp = @actor.maxhp # Actor's max HP
@sp = @actor.sp # Actor's current SP
@maxsp = @actor.maxsp # Actor's max SP
@exp = @actor.exp # Actor's current exp
@nexp = @actor.next_exp_s # The exp required for a level-up
@level = @actor.level # Actor's current level
@gold = $game_party.gold # The amount of gold currently in possession
refresh
else
@gold = $game_party.gold # The amount of gold currently in possession
no_actor
end
end
end
end


This can be customized quite easily by anyone with a little scripting experience.

I'm not sure of what can interfere with this code, but it'd be best to use this without a CBS that includes an HUD. I am not certain if the SDK is compatable, as I don't use the SDK at all. But, this HUD can be used for many different situations.

[Show/Hide] Screenshots
Attached File  Simple_HUD_Screenshot_1.png ( 95.94K ) Number of downloads: 185

Attached File  Simple_HUD_Screenshot_2.png ( 95.35K ) Number of downloads: 82
Attached File  Simple_HUD_v1.1_Screenshot_1.png ( 86.59K ) Number of downloads: 57


Version 1.1 Demo

Just paste the script above Main and add the window to Scene_Map by putting this in
the Scene with the other similar lines:

@hud_window = Window_HUD.new
@hud_window.dispose
@hud_window.update


[Show/Hide] Previous Versions
[Show/Hide] Version 1.0 Script
CODE
#-------------------------------------------------------------------------------
# Simple HUD (Heads-Up Display) v1.0
#-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-
# Created by Kendorei
#-------------------------------------------------------------------------------

class Window_HUD < Window_Base
attr_accessor :actor
def initialize
super(0, 0, 160, 189)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 160 # This makes the HUD transparent
self.visible = $game_switches[1] # This toggles the HUD via a switch
@hud_variable = $game_variables[1] # This variable controls which party member is viewed
@actor = $game_party.actors[@hud_variable] # This makes the HUD display the actor in the corresponding party slot
@name = @actor.name # Actor's name
@class_name = @actor.class_name # Actor's class
@hp = @actor.hp # Actor's current HP
@maxhp = @actor.maxhp # Actor's max HP
@sp = @actor.sp # Actor's current SP
@maxsp = @actor.maxsp # Actor's max SP
@exp = @actor.exp # Actor's current exp
@nexp = @actor.next_exp_s # The exp required for a level-up
@level = @actor.level # Actor's current level
@gold = $game_party.gold # The amount of gold currently in possession
@graphic = @actor # The actor's sprite
refresh
end
#-------------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(40, 0, 80, 25, @name.to_s)
self.contents.draw_text(50, 25, 70, 20, @class_name.to_s)
self.contents.draw_text(50, 45, 70, 20, "HP: "+@hp.to_s+"/"+@maxhp.to_s)
self.contents.draw_text(50, 65, 70, 20, "SP: "+@sp.to_s+"/"+@maxsp.to_s)
self.contents.draw_text(50, 85, 70, 20, "EXP: "+@exp.to_s+"/"+@nexp.to_s)
self.contents.draw_text(50, 105, 70, 20, "Lvl "+@level.to_s)
self.contents.draw_text(40, 125, 80, 20, "Gold: "+@gold.to_s)
draw_actor_graphic(@graphic, 10, 50)
end
#-------------------------------------------------------------------------------
def update
if (self.visible != $game_switches[1]) or
(@hud_variable != $game_variables[1]) or
(@actor != $game_party.actors[@hud_variable]) or
(@class_name != @actor.class_name) or
(@hp != @actor.hp) or
(@maxhp != @actor.maxhp) or
(@sp != @actor.sp) or
(@maxsp != @actor.maxsp) or
(@exp != @actor.exp) or
(@level != @actor.level) or
(@gold != $game_party.gold)
self.visible = $game_switches[1] # This makes the HUD visible or invisible
@hud_variable = $game_variables[1] # This variable controls which party member is viewed
@actor = $game_party.actors[@hud_variable]
@name = @actor.name # Actor's name
@class_name = @actor.class_name # Actor's class
@hp = @actor.hp # Actor's current HP
@maxhp = @actor.maxhp # Actor's max HP
@sp = @actor.sp # Actor's current SP
@maxsp = @actor.maxsp # Actor's max SP
@exp = @actor.exp # Actor's current exp
@nexp = @actor.next_exp_s # The exp required for a level-up
@level = @actor.level # Actor's current level
@gold = $game_party.gold # The amount of gold currently in possession
@graphic = @actor # The actor's sprite
refresh
end
end
end
Version 1.0 Demo


No credit is needed for such a simple script, thank you. happy.gif

This post has been edited by Kendorei: Jan 11 2009, 01:17 AM


__________________________
Kendorei, Old Soul

Current Project: Elemental War: Blade of Elements

Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.

My scripts:
Go to the top of the page
 
+Quote Post
   
jens009
post Jan 4 2009, 11:14 PM
Post #2


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

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




At first I was going to say: "Omg. Another noob HUD." This will lag for sure.

But then I looked at how your script and I saw this:
CODE
if (self.visible != $game_switches[1]) or
(@hud_variable != $game_variables[1]) or
(@actor != $game_party.actors[@hud_variable]) or
(@class_name != @actor.class_name) or
(@hp != @actor.hp) or
(@maxhp != @actor.maxhp) or
(@sp != @actor.sp) or
(@maxsp != @actor.maxsp) or
(@exp != @actor.exp) or
(@level != @actor.level) or
(@gold != $game_party.gold)
...
end

Good job! This prevents lagging the system.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Kendorei
post Jan 7 2009, 03:22 PM
Post #3


Level 2
Group Icon

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Intermediate




Thanks for the compliment jens009. happy.gif I'll admit, I had it all on one line before, and lagged horribly. xD But I split the if statement afterwards, and no lag. laugh.gif I'd like to learn more of scripting, and some spriting too, but at the moment, my only real talent is using Events. sweat.gif

This post has been edited by Kendorei: Jan 7 2009, 03:22 PM


__________________________
Kendorei, Old Soul

Current Project: Elemental War: Blade of Elements

Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.

My scripts:
Go to the top of the page
 
+Quote Post
   
Mickadell
post Jan 17 2009, 01:24 AM
Post #4


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Comment

Useful.
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 12:20 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker