A script a day, three days on the run. I've just had a random urge to script like hell lately, as it's Easter. :D
Anyway! This time I've created a simple HUD.
Features:
• Location display
• Playtime display
• Hide/Show function (Toggle: Q)
• Gold display, can be toggled on/off (Toggle: W)
• Allow/Disallow player from toggling the window/gold displays
• If you have any other suggestions, contact me. ;)
[spoiler=Screeny]
CURRENTLY UNDER CONSTRUCTION
Ver 1.1
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi163.photobucket.com%2Falbums%2Ft302%2Fpsychomathic-paniac%2FHUD-1.png&hash=2f37454c5513307857f760ce5a9b3a7bf28136a6)[/spoiler]
Replace this with your whole Scene_Map script.
[spoiler=Script]#==============================================
# Simple HUD
# Ver. 1.2
# By Rune
#==============================================
# If you want to allow gold to be toggled,
# set $TOG_GOLD to true, otherwise leave it
# on false. To allow or disallow in-game, use
# a call script command:
#==============
# $TOG_GOLD = true/false
# return true
#==============
# Set to true to allow, set to false to
# disallow.
#----------------------------------------------
#----------------------------------------------
# If you wish to stop the player from toggling
# the window on or off, change $FORCE_DISPLAY
# to true. Otherwise, set it to false.
# To allow/disallow toggle in-game, use a call
# script command:
#==============
# $FORCE_DISPLAY = true/false
# return true
#==============
# Set to false to allow, set to true to
# disallow.
#----------------------------------------------
#----------------------------------------------
# If you wish to display gold, set $GOLD to
# true. Otherwise, set it to false.
# To change in-game, Use a call script command:
#==============
# $GOLD = true/false
# return true
#==============
# Set to true to display, set to false to hide
#==============================================
$FORCE_DISPLAY = false
$TOG_GOLD = false
$GOLD = true
$data_mapinfos = load_data('Data/MapInfos.rxdata')
class Window_HUD < Window_Base
def initialize
if $GOLD == true
super(0, 0, 160, 188)
elsif $GOLD != true
super(0, 0, 160, 156)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 128, 32, "Location")
self.contents.font.color = normal_color
name = $data_mapinfos[$game_map.map_id].name
self.contents.draw_text(0, 32, 128, 32, name, 1)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 96, 120, 32, text, 2)
if $GOLD == true
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 128, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 128, cx, 32, $data_system.words.gold, 2)
elsif $GOLD == false
end
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Make HUD window
@hud_window = Window_HUD.new
# Transition run
Graphics.transition
# 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
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose of HUD window
@hud_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# Update HUD window
@hud_window.refresh
# If L (Default Q) button is pressed
if $FORCE_DISPLAY == false
if Input.trigger?(Input::L) and @hud_window.visible == true
@hud_window.visible = false
return
end
if Input.trigger?(Input::L) and @hud_window.visible != true
@hud_window.visible = true
return
end
elsif $FORCE_DISPLAY != false
if Input.trigger?(Input::L)
end
end
# If R (Default W) button is pressed
if $TOG_GOLD == true
if Input.trigger?(Input::R) and $GOLD == true
$GOLD = false
@hud_window.height = 156
@hud_window.refresh
return
end
if Input.trigger?(Input::R) and $GOLD != true
$GOLD = true
@hud_window.height = 188
@hud_window.refresh
return
end
elsif $TOG_GOLD != true
if Input.trigger?(Input::R)
end
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end
[/spoiler]
Instructions on toggling gold/window display, are in the script, at the top.
Any problems/queries, contact me. ;)
Looks good Rune - I would give the option to hide it though by pressing a key, seeing as it is rather large.
Also, I don't know how crucial a gold display is - it doesn't change that often and it is not necessary to know it at all times.
I think you should alias some of these methods. Scene_Map update is a fairly crucial method and a lot of other scripts are likely to also use it. Thus, you could increase compatibility significantly.
Anyway, nice work Rune.
I would alias, if I knew how :P Could you link me to anything I could learn from?
I'll add a hide function now :P and possibly remove the gold display.
~Edit
Updated
I think this is really cool, but the Playtime isn't excactly needed. So if you could just tell me WHERE in the script I can remove it, that'd be nice. Also, how about being able to change the location of it?
Just a couple o' comments...
To remove the playtime, simply remove:
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 96, 120, 32, text, 2)
and
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
On the line:
super(0, 0, 160, 156)
Change the 156 to 96
On that line also, the two first numbers set the location of the window. Going up to 640, 480 (pixels).
Simply change that.
To change the location in-game, simply use a call script command:
@hud_window.x = X
@hud_window.y = Y
Change the X and Y to the x and y co-ordinates of the window (from the top left hand corner).
OK, thanks! :)
EDIT: Okay, I did it, and it worked fine. Now I have another thing: It seems so big, that box. So big, much of the screen "dissapears" behind it. Would it be able to make it smaller (Not through a call script event, but by changing the script..?). Also, being able to turn the Gold Display on or off would be nice. I didn't see the first version of this, but the gold sounds cool...
So,
I'd like the box a bit smaller and thinner, and I want the option to turn on and off the display of your gold. If not, or if it's too much/hard/it would look ugly, then forget it. Nice script! :)
It would be hard to make the box any smaller. It may already have problems with long map names.
But I have added an option to show/hide the window, if that helps much.
I'll sort the gold display out ;)
Nice, thx! Don't bother changing the size then, 'sides, you're gonna have to change the size of it with the gold thing added (when it's on, not when it's off...)
Right, I've done editing, I just need to finish adding comments.
Will update as soon as I'm done. ;)
Nice
Updated. Check first post. Sorry I was a bit slow, had my mind on other things. :P
I know what ya mean. Now to trying it out...
the text dose not show up why? :mex:
In between the lines
self.contents.clear
and
self.contents.font.color = system_color
Insert this line
self.contents.font.type = "Tahoma"
That should work, if not, change type to name, although I'm pretty sure it's type.
If that doesn't work either, check that you have the font "Tahoma" installed on your computer, though you should do.
Post back here if none of those work.
QuoteIn between the lines
Code: self.contents.clear
and
Code: self.contents.font.color = system_color
Insert this line
Code: self.contents.font.type = "Tahoma"
Can you use a font that other pc doesn't have?
No, you need to provide the font to the user if it is not a common font.
You can use any font as long as is installed on the user's computer, some games automatically install them, such as Chaos Project, so I expect there to a script that does exactly that somewhere on the internet.
how do you disable this?
because i have a cutscene and
the HUD shows
Underneath
@hud_window = Window_HUD.new
Add
@hud_window.visible = false
That automatically turns the window off.
If you would like to disable the player from toggling it on or off at certain points in the game, such as the cutscene, make a call script command and type this into it:
$FORCE_DISPLAY = true/false
return true
Delete true or false according to whether you want to allow or disallow toggling.
True disallows and false allows.
To turn the window on or off (for other cutscenes, etc) simply make another call script command and type into it:
@hud_window.visible = true/false
return true
Where true shows the window and false turns it off.
*breathes*
Any more problems, I'm here ;)
which one should i use?
and i tried both as call script and
it doesn't work
how exactly do u
do this?
Use both, for cutscenes where you don't want the window to be displayed, use the second one with false, and then use the first one with true.
it still not working
this is what i did
[spoiler]
is this correct?
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg204.imageshack.us%2Fimg204%2F1381%2F90540842rn2.jpg&hash=3017412655033620312a9c74bb7adddc93af8ad9)[/spoiler]
Do you get an error message? What happens when this event is activated?
nothing happened when i used it
it still works normally
I got an error when I did exactly that. :-\
Try searching through your script for anything that says @hud_window and change the @ on every line found to $
Then in the call script, do the same with the @ there.
If that doesn't work, say. If any other scripters have any suggestions, feel free to say. ;)
so if your did an error
so what i did was different?
what did you do?
and the @ and $ thinggy has an error
with
Shud_window = Window_HUD.new
im sorry
my mistake i used S instead of $
but it still doesn't work
I did exactly what you did.
I can't help at the moment, sorry. :-\ I'll get back to you once I've discovered the cause.
Okay, I'm having a problem. My game starts inside a cave, and as soon as I leave the cave, the game locks up so all it does is play the waterfall sound effect.
First off, remove my script from the game to check if it's that that's causing the problem. If it is, tell me, and I'll look into it.
Okay, I took the script out and that didn't fix it, but then I took the waterfall sound out and that did. It wasn't really needed, anyway. Thanks!
Fair enough then, glad it works now. ^_^
i'd like to know how to change the location to
HP hp/maxhp
(of course hp is the main actor's hp and haxhp is his max HP
and replace the play time with
SP sp/maxsp
so it looks like
HP 600/1000
SP 500/500
with the gold still toggle on/off-able.
Can someone please post that script or tell me how to do it?
P.S. IM A NOOB
[spoiler]#==============================================
# Simple HUD
# Ver. 1.2
# By Rune
#==============================================
# If you want to allow gold to be toggled,
# set $TOG_GOLD to true, otherwise leave it
# on false. To allow or disallow in-game, use
# a call script command:
#==============
# $TOG_GOLD = true/false
# return true
#==============
# Set to true to allow, set to false to
# disallow.
#----------------------------------------------
#----------------------------------------------
# If you wish to stop the player from toggling
# the window on or off, change $FORCE_DISPLAY
# to true. Otherwise, set it to false.
# To allow/disallow toggle in-game, use a call
# script command:
#==============
# $FORCE_DISPLAY = true/false
# return true
#==============
# Set to false to allow, set to true to
# disallow.
#----------------------------------------------
#----------------------------------------------
# If you wish to display gold, set $GOLD to
# true. Otherwise, set it to false.
# To change in-game, Use a call script command:
#==============
# $GOLD = true/false
# return true
#==============
# Set to true to display, set to false to hide
#==============================================
$FORCE_DISPLAY = false
$TOG_GOLD = true
$GOLD = true
$CHAR = 0 # Use the technique described above
# to change this if you are changing
# character in-game. Starts from 0
#(Arshes = 0, Basil = 1, etc)
class Window_HUD < Window_Base
def initialize
if $GOLD == true
super(0, 0, 192, 128)
elsif $GOLD != true
super(0, 0, 192, 96)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
def refresh
self.contents.clear
draw_actor_hp($game_party.actors[$CHAR], 4, 0)
draw_actor_sp($game_party.actors[$CHAR], 4, 32)
if $GOLD == true
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 64, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 64, cx, 32, $data_system.words.gold, 2)
elsif $GOLD != true
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Make HUD window
@hud_window = Window_HUD.new
# Transition run
Graphics.transition
# 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
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose of HUD window
@hud_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# Update HUD window
@hud_window.refresh
# If L (Default Q) button is pressed
if $FORCE_DISPLAY == false
if Input.trigger?(Input::L) and @hud_window.visible == true
@hud_window.visible = false
return
end
if Input.trigger?(Input::L) and @hud_window.visible != true
@hud_window.visible = true
return
end
elsif $FORCE_DISPLAY != false
if Input.trigger?(Input::L)
end
end
# If R (Default W) button is pressed
if $TOG_GOLD == true
if Input.trigger?(Input::R) and $GOLD == true
$GOLD = false
@hud_window.height = 96
@hud_window.refresh
return
end
if Input.trigger?(Input::R) and $GOLD != true
$GOLD = true
@hud_window.height = 128
@hud_window.refresh
return
end
elsif $TOG_GOLD != true
if Input.trigger?(Input::R)
end
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end[/spoiler]
Doneded. Should be plug n' play. There's a nice little note I added underneath the instructions that I think you may want to look at ;)
Have fun, kiddies
lol thanks I'm like it.
Could you please just make a version that shows the area only in the upper right, and HP/SP in the upper left? Or the other way around?
Shouldn't be a problem. I'll get onto it now.
~Edit;
[spoiler]#==============================================
# Simple HUD
# Ver. 1.2
# By Rune
#==============================================
# If you wish to stop the player from toggling
# the window on or off, change $FORCE_DISPLAY
# to true. Otherwise, set it to false.
# To allow/disallow toggle in-game, use a call
# script command:
#==============
# $FORCE_DISPLAY = true/false
# return true
#==============
# Set to false to allow, set to true to
# disallow.
#==============================================
$FORCE_DISPLAY = false
$CHAR = 0 # Use the technique described above
# to change this if you are changing
# character in-game. Starts from 0
# (Arshes = 0, Basil = 1, etc)
$data_mapinfos = load_data('Data/MapInfos.rxdata')
class Window_HPSP < Window_Base
def initialize
super(448, 0, 192, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
def refresh
self.contents.clear
draw_actor_hp($game_party.actors[$CHAR], 4, 0)
draw_actor_sp($game_party.actors[$CHAR], 4, 32)
end
end
class Window_Loc < Window_Base
def initialize
super(0, 0, 192, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 160, 32, "Location")
self.contents.font.color = normal_color
name = $data_mapinfos[$game_map.map_id].name
self.contents.draw_text(0, 32, 160, 32, name, 1)
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Make HP/SP window
@hpsp_window = Window_HPSP.new
# Make Location window
@loc_window = Window_Loc.new
# Transition run
Graphics.transition
# 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
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose of HP/SP window
@hpsp_window.dispose
# Dispose of Location window
@loc_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# Update HP/SP window
@hpsp_window.refresh
# Update Location window
@loc_window.refresh
# If L (Default Q) button is pressed
if $FORCE_DISPLAY == false
if Input.trigger?(Input::L) and @hpsp_window.visible == true
@hpsp_window.visible = false
@loc_window.visible = false
return
end
if Input.trigger?(Input::L) and @hpsp_window.visible != true
@hpsp_window.visible = true
@loc_window.visible = true
return
end
elsif $FORCE_DISPLAY != false
if Input.trigger?(Input::L)
end
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# * Shop Call
#--------------------------------------------------------------------------
def call_shop
# Clear shop call flag
$game_temp.shop_calling = false
# Straighten player position
$game_player.straighten
# Switch to shop screen
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# * Name Input Call
#--------------------------------------------------------------------------
def call_name
# Clear name input call flag
$game_temp.name_calling = false
# Straighten player position
$game_player.straighten
# Switch to name input screen
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# * Menu Call
#--------------------------------------------------------------------------
def call_menu
# Clear menu call flag
$game_temp.menu_calling = false
# If menu beep flag is set
if $game_temp.menu_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Clear menu beep flag
$game_temp.menu_beep = false
end
# Straighten player position
$game_player.straighten
# Switch to menu screen
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# * Save Call
#--------------------------------------------------------------------------
def call_save
# Straighten player position
$game_player.straighten
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Debug Call
#--------------------------------------------------------------------------
def call_debug
# Clear debug call flag
$game_temp.debug_calling = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Straighten player position
$game_player.straighten
# Switch to debug screen
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
# Clear player place move call flag
$game_temp.player_transferring = false
# If move destination is different than current map
if $game_map.map_id != $game_temp.player_new_map_id
# Set up a new map
$game_map.setup($game_temp.player_new_map_id)
end
# Set up player position
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# Set player direction
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
# Straighten player position
$game_player.straighten
# Update map (run parallel process event)
$game_map.update
# Remake sprite set
@spriteset.dispose
@spriteset = Spriteset_Map.new
# If processing transition
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
Graphics.transition(20)
end
# Run automatic change for BGM and BGS set on the map
$game_map.autoplay
# Frame reset
Graphics.frame_reset
# Update input information
Input.update
end
end[/spoiler]
Plug n' play, again, there's a note underneath the instructions which you may want to look at if you're considering changing characters through the game. I put the windows where, in my opinion, they look best. LOcation in the top right, HP/SP in the top left.
Have fun, and don't touch anything that glows.
Thanks, that helped. I'm definitely using it.
Quote from: Demonic Blade on March 25, 2008, 01:47:44 PM
OK, thanks! :)
EDIT: Okay, I did it, and it worked fine. Now I have another thing: It seems so big, that box. So big, much of the screen "dissapears" behind it. Would it be able to make it smaller (Not through a call script event, but by changing the script..?). Also, being able to turn the Gold Display on or off would be nice. I didn't see the first version of this, but the gold sounds cool...
So,
I'd like the box a bit smaller and thinner, and I want the option to turn on and off the display of your gold. If not, or if it's too much/hard/it would look ugly, then forget it. Nice script! :)
you can did it?
why mine not?
i tried to test it..
but after i go to new game, it's says: Unable to find file Graphics/Pictures/BAR_Meter.
why there is no folder contain that kind of graphic here?
and where i must place the folder?
Umm if i don't want the box to the left that says where I am, but i do like the box to the right with the HP and SP what do i need to take out?
Also could you add like an EXP thing on the HP/SP box? like how much more you need to level up?
Thanks and btw i love the script :)
EDIT: never mind i got it. lol thanks again.