Simple Pop Up Hud
Version 1.0
Author: Maximusmaxy
Release Date: 3/10/2011
Introduction
Let's say your walking around and you want to know how much HP your on, or how much gold you have, but you don't want to stop to open up the menu, and you don't want to have an ugly hud ruining the aesthetics of your game. Well then you need a Simple Pop Up Hud!
Features
- Configurable Unobtrusive Hud displaying vital information
- Faceset support
- World Map Display
Script
CODE
#===============================================================================
# Simple Pop Up Hud
# Author: Maximusmaxy
# Version: 1.0
#===============================================================================
# Version 1.0: 3/10/2011
#===============================================================================
#
# Introduction:
# This is just a simple pop up hud to show menu information on the fly. You can
# choose which huds you want to be displayed, and which key activates the hud
# in the configuration.
#
# Instructions:
# To use facesets for the hud, place the images in your pictures folder with the
# actors name as the file name with a '_face' on the end EG. Aluxes_face.png
# It is recommended to use faces of size 96x96 or smaller or they will not fit
# in the window.
#
# To use your own world map replace the existing one with the exact same file
# name 'World Map.png'. The World map is recommended to be 280x280 or smaller,
# otherwise it won't fit properly inside the box and may look stretched/blurry.
# You can change the location of the arrow using the call script. The easiest
# way to find the locations for the arrow is using your favourite picture
# editting software. Even MS Paint works. You can also change the map displayed
# with a call script.
#
# The script calls are as follows:
#
# POP_UP.enable
# enables all huds
#
# POP_UP.disable
# disables all huds
#
# It is recommended to disable the hud before cutscenes, and re-enable the hud
# afterwards.
#
# POP_UP.info_enable
# enables info seperately
#
# POP_UP.info_disable
# disables info seperately
#
# POP_UP.stats_enable
# enables stats seperately
#
# POP_UP.stats.disable
# disables stats seperately
#
# POP_UP.map_enable
# enables map seperately
#
# POP_UP.map_disable
# disables map seperately
#
# POP_UP.location(X,Y)
# X,Y is the location on the map the arrow will point to
#
# POP_UP.map(FILE)
# FILE is the filename of the new map picture
#
#===============================================================================
module POP_UP
#===============================================================================
# Configuration
#===============================================================================
#input key for displaying the hud
INPUT = Input::A
#huds to pop up
INFO = true
STATS = true
MAP = true
#where you want it to pop up.
#top left = 0, top right = 1, bottom left = 2, bottom right = 3
INFO_LOC = 1
STATS_LOC = 0
MAP_LOC = 2
#true if you want to use facesets, false for default sprites
FACE = true
#===============================================================================
# End Configuration
#===============================================================================
def self.enable
$game_system.pop_up_hud_enabled = true
end
def self.disable
$game_system.pop_up_hud_enabled = false
$game_temp.pop_up_hud_dispose = true
end
def self.info_enable
$game_system.pop_up_info_enabled = true
$game_map.need_refresh = true
end
def self.info_disable
$game_system.pop_up_info_enabled = false
$game_map.need_refresh = true
end
def self.stats_enable
$game_system.pop_up_stats_enabled = true
$game_map.need_refresh = true
end
def self.stats_disable
$game_system.pop_up_stats_enabled = false
$game_map.need_refresh = true
end
def self.map_enable
$game_system.pop_up_map_enabled = true
$game_map.need_refresh = true
end
def self.map_disable
$game_system.pop_up_map_enabled = false
$game_map.need_refresh = true
end
def self.location(x,y)
$game_system.pop_up_location_x = x
$game_system.pop_up_location_y = y
end
def self.map(file)
$game_system.pop_up_map = file
end
end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :pop_up_hud_dispose
alias max_pop_initialize_later initialize
def initialize
max_pop_initialize_later
#added temp switch
@pop_up_hud_dispose = false
end
end
#===============================================================================
# Game_System
#===============================================================================
class Game_System
attr_accessor :pop_up_hud_enabled
attr_accessor :pop_up_info_enabled
attr_accessor :pop_up_stats_enabled
attr_accessor :pop_up_map_enabled
attr_accessor :pop_up_location_x
attr_accessor :pop_up_location_y
attr_accessor :pop_up_map
alias max_pop_initialize_later initialize
def initialize
max_pop_initialize_later
#switch to enable/disable hud
@pop_up_hud_enabled = true
#individual hud switches
@pop_up_info_enabled = true
@pop_up_stats_enabled = true
@pop_up_map_enabled = true
#map displayed
@pop_up_map = ''
#arrow location
@pop_up_location_x = 0
@pop_up_location_y = 0
end
end
#===============================================================================
# Bitmap
#===============================================================================
class Bitmap
def draw_text_pop_up(x,y,w,h,text,align = 0)
#draws shaded text
color = self.font.color.clone
self.font.color.set(0,0,0,150)
draw_text(x+1,y+1,w,h,text,align)
draw_text(x+1,y-1,w,h,text,align)
draw_text(x-1,y+1,w,h,text,align)
draw_text(x-1,y-1,w,h,text,align)
self.font.color = color
draw_text(x,y,w,h,text,align)
end
def fill_rect_pop_up(x,y,w,h,color)
#draws shaded rectangle
black = Color.new(0,0,0)
fill_rect(x+1,y+1,w,h,black)
fill_rect(x+1,y-1,w,h,black)
fill_rect(x-1,y+1,w,h,black)
fill_rect(x-1,y-1,w,h,black)
fill_rect(x,y,w,h,color)
end
end
#===============================================================================
# Window_Pop_Up
#===============================================================================
class Window_Pop_Up < Window_Base
attr_reader :dispose_me
#the direction variable is like the moveing/facing variable (2,4,6,8)
def initialize(x, y, width, height, direction, speed = 24.0)
super(x, y, width, height)
self.z = 5000
self.opacity = 150
@count = 0
@dispose_me = false
@disposed = false
@speed = speed
@change_x = (direction == 6 ? 1 : direction == 4 ? -1 : 0)
@change_y = (direction == 2 ? 1 : direction == 8 ? -1 : 0)
@inc = (@change_x != 0 ? width / speed : height / speed)
$game_system.se_play($data_system.decision_se)
$game_temp.pop_up_hud_dispose = false
end
def update
#increase count
@count += 1
if @count <= @speed
if Input.press?(POP_UP::INPUT) && !$game_temp.pop_up_hud_dispose
#move window inward if triggered
self.x += @inc * @change_x
self.y += @inc * @change_y
else
#reset
@count = @speed * 2 - (@count - 1)
end
elsif @count > @speed && @count != @speed * 2
#if triggered again move back
if Input.trigger?(POP_UP::INPUT)
$game_system.se_play($data_system.decision_se)
#reset
@count = @speed * 2 - (@count - 1)
#if pressed hold in position
elsif Input.press?(POP_UP::INPUT) && !$game_temp.pop_up_hud_dispose
@count -= 1
#move window outward
else
self.x -= @inc * @change_x
self.y -= @inc * @change_y
end
elsif @count == @speed * 2
#dispose if outside of view
@dispose_me = true
$game_temp.pop_up_hud_dispose = false if $game_temp.pop_up_hud_dispose
end
end
end
#===============================================================================
# Window_Pop_Up_Info
#===============================================================================
class Window_Pop_Up_Info < Window_Pop_Up
def initialize
case POP_UP::INFO_LOC
when 0
super(-192,0,192,168,6)
when 1
super(640,0,192,168,4)
when 2
super(-192,312,192,168,6)
when 3
super(640,312,192,168,4)
end
self.contents = Bitmap.new(width-32,height-32)
@gold = 0
@steps = 0
@time = 0
@semicolon = true
refresh
end
def refresh
self.contents.clear
#map name
map_name = load_data('Data/MapInfos.rxdata')
self.contents.draw_text_pop_up(0,0,160,32,map_name[$game_map.map_id].name,1)
self.contents.fill_rect_pop_up(1,30,158,1,Color.new(255,255,255))
#gold
self.contents.draw_text_pop_up(0, 32, 160, 32,
$game_party.gold.to_s + $data_system.words.gold)
@gold = $game_party.gold
#play time
total_sec = Graphics.frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
if @semicolon
text = sprintf("%02d:%02d:%02d", hour, min, sec)
else
text = sprintf("%02d %02d %02d", hour, min, sec)
end
self.contents.draw_text_pop_up(0, 64, 160, 32, text)
@time = total_sec
#steps
self.contents.draw_text_pop_up(0, 96, 160, 32,
"Steps: " + $game_party.steps.to_s)
@steps = $game_party.steps
end
def update
super
#refresh if content is different
if @time != Graphics.frame_count / Graphics.frame_rate
@semicolon = !@semicolon
refresh
elsif @steps != $game_party.steps || @gold != $game_party.gold
refresh
end
end
end
#===============================================================================
# Window_Pop_Up_Stats
#===============================================================================
class Window_Pop_Up_Stats < Window_Pop_Up
def initialize
case POP_UP::STATS_LOC
when 0
super(0,-168,448,168,2)
when 1
super(192,-168,448,168,2)
when 2
super(0,480,448,168,8)
when 3
super(192,480,448,168,8)
end
self.contents = Bitmap.new(width - 32,height - 32)
@hp = []
@sp = []
@exp = []
refresh
end
def refresh
self.contents.clear
x = (4 - $game_party.actors.size) * 52
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
#draw the actor data
if FileTest.exist?(
'Graphics/Pictures/' + actor.name + '_face.png') && POP_UP::FACE
picture = RPG::Cache.picture(actor.name + '_face')
pw = picture.width
ph = picture.height
self.contents.blt(i * 104 + x + 4 + (48 - pw / 2), 48 - ph / 2,
picture, picture.rect,200)
else
draw_actor_graphic(actor, i * 104 + 48 + x, 56)
end
draw_actor_hp(actor, i * 104 + x, 56)
draw_actor_sp(actor, i * 104 + x, 80)
draw_actor_exp(actor, i * 104 + x, 104)
@hp[i] = actor.hp
@sp[i] = actor.sp
@exp[i] = actor.next_rest_exp_s
end
end
def update
super
#refresh if content is different
for i in 0...$game_party.actors.size
if @hp[i] != $game_party.actors[i].hp ||
@sp[i] != $game_party.actors[i].sp ||
@exp[i] != $game_party.actors[i].next_rest_exp_s
refresh
return
end
end
end
def draw_actor_hp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text_pop_up(x + 32, y, 71, 32, actor.hp.to_s,2)
self.contents.font.color = normal_color
end
def draw_actor_sp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text_pop_up(x + 32, y, 71, 32, actor.sp.to_s,2)
self.contents.font.color = normal_color
end
def draw_actor_exp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 48, 32, 'Exp')
self.contents.draw_text_pop_up(x + 48, y, 55, 32,
actor.next_rest_exp_s.to_s,2)
end
end
#===============================================================================
# Window_Pop_Up_Map
#===============================================================================
class Window_Pop_Up_Map < Window_Pop_Up
attr_accessor :arrow
def initialize
case POP_UP::MAP_LOC
when 0
super(-312,0,312,312,6)
when 1
super(640,0,312,312,4)
when 2
super(-312,168,312,312,6)
when 3
super(640,168,312,312,4)
end
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.pop_up_map == ''
if FileTest.exist?('Graphics/Pictures/World Map.png')
@picture = RPG::Cache.picture('World Map')
$game_system.pop_up_map = 'World Map'
else
return
end
else
@picture = RPG::Cache.picture($game_system.pop_up_map)
end
@picture_x = 140 - @picture.width / 2
@picture_y = 140 - @picture.height / 2
@arrow = Arrow_Base.new(nil)
@arrow.z = 5100
refresh
end
def refresh
self.contents.clear
#if too big stretch
if @picture.width > 280 || @picture.height > 280
self.contents.stretch_blt(Rect.new(0,0,280,280),@picture,
@picture.rect,200)
else
self.contents.blt(@picture_x,@picture_y,@picture,
@picture.rect,200)
end
end
def update
super
#update picture if different
if @picture != $game_system.pop_up_map
@picture = RPG::Cache.picture($game_system.pop_up_map)
@picture_x = 140 - @picture.width / 2
@picture_y = 140 - @picture.height / 2
refresh
end
#don't update the arrow if it doesn't exist
return if @arrow.nil?
#dispose the arrow if disposing
if @dispose_me
@arrow.dispose
return
end
#only update arrow when completed movement
if @count == @speed
@arrow.update
end
#update arrow location
@arrow.x = self.x + 16 + $game_system.pop_up_location_x + @picture_x
@arrow.y = self.y + 80 + $game_system.pop_up_location_y + @picture_y
end
end
#===============================================================================
# Scene_Map
#===============================================================================
class Scene_Map
alias max_pop_main_later main
alias max_pop_update_later update
def main
max_pop_main_later
#dispose the hud if its active and changing scenes
@pop_up_info.dispose unless @pop_up_info.nil?
@pop_up_stats.dispose unless @pop_up_stats.nil?
@pop_up_map.arrow.dispose unless @pop_up_map.nil?
@pop_up_map.dispose unless @pop_up_map.nil?
end
def update
max_pop_update_later
#info window
unless @pop_up_info.nil?
#dispose if flagged for disposal
if @pop_up_info.dispose_me
@pop_up_info.dispose
@pop_up_info = nil
else
#update the hud
@pop_up_info.update
end
end
#stats window
unless @pop_up_stats.nil?
#dispose if flagged for disposal
if @pop_up_stats.dispose_me
@pop_up_stats.dispose
@pop_up_stats = nil
else
#update the hud
@pop_up_stats.update
end
end
#map window
unless @pop_up_map.nil?
#dispose if flagged for disposal
if @pop_up_map.dispose_me
@pop_up_map.dispose
@pop_up_map = nil
else
#update the hud
@pop_up_map.update
end
end
if Input.press?(POP_UP::INPUT) && $game_system.pop_up_hud_enabled
#create the huds
if POP_UP::INFO && @pop_up_info.nil? && $game_system.pop_up_info_enabled
@pop_up_info = Window_Pop_Up_Info.new
end
if POP_UP::STATS && @pop_up_stats.nil? && $game_system.pop_up_stats_enabled
@pop_up_stats = Window_Pop_Up_Stats.new
end
if POP_UP::MAP && @pop_up_map.nil? && $game_system.pop_up_map_enabled
@pop_up_map = Window_Pop_Up_Map.new
end
end
end
end
# Simple Pop Up Hud
# Author: Maximusmaxy
# Version: 1.0
#===============================================================================
# Version 1.0: 3/10/2011
#===============================================================================
#
# Introduction:
# This is just a simple pop up hud to show menu information on the fly. You can
# choose which huds you want to be displayed, and which key activates the hud
# in the configuration.
#
# Instructions:
# To use facesets for the hud, place the images in your pictures folder with the
# actors name as the file name with a '_face' on the end EG. Aluxes_face.png
# It is recommended to use faces of size 96x96 or smaller or they will not fit
# in the window.
#
# To use your own world map replace the existing one with the exact same file
# name 'World Map.png'. The World map is recommended to be 280x280 or smaller,
# otherwise it won't fit properly inside the box and may look stretched/blurry.
# You can change the location of the arrow using the call script. The easiest
# way to find the locations for the arrow is using your favourite picture
# editting software. Even MS Paint works. You can also change the map displayed
# with a call script.
#
# The script calls are as follows:
#
# POP_UP.enable
# enables all huds
#
# POP_UP.disable
# disables all huds
#
# It is recommended to disable the hud before cutscenes, and re-enable the hud
# afterwards.
#
# POP_UP.info_enable
# enables info seperately
#
# POP_UP.info_disable
# disables info seperately
#
# POP_UP.stats_enable
# enables stats seperately
#
# POP_UP.stats.disable
# disables stats seperately
#
# POP_UP.map_enable
# enables map seperately
#
# POP_UP.map_disable
# disables map seperately
#
# POP_UP.location(X,Y)
# X,Y is the location on the map the arrow will point to
#
# POP_UP.map(FILE)
# FILE is the filename of the new map picture
#
#===============================================================================
module POP_UP
#===============================================================================
# Configuration
#===============================================================================
#input key for displaying the hud
INPUT = Input::A
#huds to pop up
INFO = true
STATS = true
MAP = true
#where you want it to pop up.
#top left = 0, top right = 1, bottom left = 2, bottom right = 3
INFO_LOC = 1
STATS_LOC = 0
MAP_LOC = 2
#true if you want to use facesets, false for default sprites
FACE = true
#===============================================================================
# End Configuration
#===============================================================================
def self.enable
$game_system.pop_up_hud_enabled = true
end
def self.disable
$game_system.pop_up_hud_enabled = false
$game_temp.pop_up_hud_dispose = true
end
def self.info_enable
$game_system.pop_up_info_enabled = true
$game_map.need_refresh = true
end
def self.info_disable
$game_system.pop_up_info_enabled = false
$game_map.need_refresh = true
end
def self.stats_enable
$game_system.pop_up_stats_enabled = true
$game_map.need_refresh = true
end
def self.stats_disable
$game_system.pop_up_stats_enabled = false
$game_map.need_refresh = true
end
def self.map_enable
$game_system.pop_up_map_enabled = true
$game_map.need_refresh = true
end
def self.map_disable
$game_system.pop_up_map_enabled = false
$game_map.need_refresh = true
end
def self.location(x,y)
$game_system.pop_up_location_x = x
$game_system.pop_up_location_y = y
end
def self.map(file)
$game_system.pop_up_map = file
end
end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :pop_up_hud_dispose
alias max_pop_initialize_later initialize
def initialize
max_pop_initialize_later
#added temp switch
@pop_up_hud_dispose = false
end
end
#===============================================================================
# Game_System
#===============================================================================
class Game_System
attr_accessor :pop_up_hud_enabled
attr_accessor :pop_up_info_enabled
attr_accessor :pop_up_stats_enabled
attr_accessor :pop_up_map_enabled
attr_accessor :pop_up_location_x
attr_accessor :pop_up_location_y
attr_accessor :pop_up_map
alias max_pop_initialize_later initialize
def initialize
max_pop_initialize_later
#switch to enable/disable hud
@pop_up_hud_enabled = true
#individual hud switches
@pop_up_info_enabled = true
@pop_up_stats_enabled = true
@pop_up_map_enabled = true
#map displayed
@pop_up_map = ''
#arrow location
@pop_up_location_x = 0
@pop_up_location_y = 0
end
end
#===============================================================================
# Bitmap
#===============================================================================
class Bitmap
def draw_text_pop_up(x,y,w,h,text,align = 0)
#draws shaded text
color = self.font.color.clone
self.font.color.set(0,0,0,150)
draw_text(x+1,y+1,w,h,text,align)
draw_text(x+1,y-1,w,h,text,align)
draw_text(x-1,y+1,w,h,text,align)
draw_text(x-1,y-1,w,h,text,align)
self.font.color = color
draw_text(x,y,w,h,text,align)
end
def fill_rect_pop_up(x,y,w,h,color)
#draws shaded rectangle
black = Color.new(0,0,0)
fill_rect(x+1,y+1,w,h,black)
fill_rect(x+1,y-1,w,h,black)
fill_rect(x-1,y+1,w,h,black)
fill_rect(x-1,y-1,w,h,black)
fill_rect(x,y,w,h,color)
end
end
#===============================================================================
# Window_Pop_Up
#===============================================================================
class Window_Pop_Up < Window_Base
attr_reader :dispose_me
#the direction variable is like the moveing/facing variable (2,4,6,8)
def initialize(x, y, width, height, direction, speed = 24.0)
super(x, y, width, height)
self.z = 5000
self.opacity = 150
@count = 0
@dispose_me = false
@disposed = false
@speed = speed
@change_x = (direction == 6 ? 1 : direction == 4 ? -1 : 0)
@change_y = (direction == 2 ? 1 : direction == 8 ? -1 : 0)
@inc = (@change_x != 0 ? width / speed : height / speed)
$game_system.se_play($data_system.decision_se)
$game_temp.pop_up_hud_dispose = false
end
def update
#increase count
@count += 1
if @count <= @speed
if Input.press?(POP_UP::INPUT) && !$game_temp.pop_up_hud_dispose
#move window inward if triggered
self.x += @inc * @change_x
self.y += @inc * @change_y
else
#reset
@count = @speed * 2 - (@count - 1)
end
elsif @count > @speed && @count != @speed * 2
#if triggered again move back
if Input.trigger?(POP_UP::INPUT)
$game_system.se_play($data_system.decision_se)
#reset
@count = @speed * 2 - (@count - 1)
#if pressed hold in position
elsif Input.press?(POP_UP::INPUT) && !$game_temp.pop_up_hud_dispose
@count -= 1
#move window outward
else
self.x -= @inc * @change_x
self.y -= @inc * @change_y
end
elsif @count == @speed * 2
#dispose if outside of view
@dispose_me = true
$game_temp.pop_up_hud_dispose = false if $game_temp.pop_up_hud_dispose
end
end
end
#===============================================================================
# Window_Pop_Up_Info
#===============================================================================
class Window_Pop_Up_Info < Window_Pop_Up
def initialize
case POP_UP::INFO_LOC
when 0
super(-192,0,192,168,6)
when 1
super(640,0,192,168,4)
when 2
super(-192,312,192,168,6)
when 3
super(640,312,192,168,4)
end
self.contents = Bitmap.new(width-32,height-32)
@gold = 0
@steps = 0
@time = 0
@semicolon = true
refresh
end
def refresh
self.contents.clear
#map name
map_name = load_data('Data/MapInfos.rxdata')
self.contents.draw_text_pop_up(0,0,160,32,map_name[$game_map.map_id].name,1)
self.contents.fill_rect_pop_up(1,30,158,1,Color.new(255,255,255))
#gold
self.contents.draw_text_pop_up(0, 32, 160, 32,
$game_party.gold.to_s + $data_system.words.gold)
@gold = $game_party.gold
#play time
total_sec = Graphics.frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
if @semicolon
text = sprintf("%02d:%02d:%02d", hour, min, sec)
else
text = sprintf("%02d %02d %02d", hour, min, sec)
end
self.contents.draw_text_pop_up(0, 64, 160, 32, text)
@time = total_sec
#steps
self.contents.draw_text_pop_up(0, 96, 160, 32,
"Steps: " + $game_party.steps.to_s)
@steps = $game_party.steps
end
def update
super
#refresh if content is different
if @time != Graphics.frame_count / Graphics.frame_rate
@semicolon = !@semicolon
refresh
elsif @steps != $game_party.steps || @gold != $game_party.gold
refresh
end
end
end
#===============================================================================
# Window_Pop_Up_Stats
#===============================================================================
class Window_Pop_Up_Stats < Window_Pop_Up
def initialize
case POP_UP::STATS_LOC
when 0
super(0,-168,448,168,2)
when 1
super(192,-168,448,168,2)
when 2
super(0,480,448,168,8)
when 3
super(192,480,448,168,8)
end
self.contents = Bitmap.new(width - 32,height - 32)
@hp = []
@sp = []
@exp = []
refresh
end
def refresh
self.contents.clear
x = (4 - $game_party.actors.size) * 52
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
#draw the actor data
if FileTest.exist?(
'Graphics/Pictures/' + actor.name + '_face.png') && POP_UP::FACE
picture = RPG::Cache.picture(actor.name + '_face')
pw = picture.width
ph = picture.height
self.contents.blt(i * 104 + x + 4 + (48 - pw / 2), 48 - ph / 2,
picture, picture.rect,200)
else
draw_actor_graphic(actor, i * 104 + 48 + x, 56)
end
draw_actor_hp(actor, i * 104 + x, 56)
draw_actor_sp(actor, i * 104 + x, 80)
draw_actor_exp(actor, i * 104 + x, 104)
@hp[i] = actor.hp
@sp[i] = actor.sp
@exp[i] = actor.next_rest_exp_s
end
end
def update
super
#refresh if content is different
for i in 0...$game_party.actors.size
if @hp[i] != $game_party.actors[i].hp ||
@sp[i] != $game_party.actors[i].sp ||
@exp[i] != $game_party.actors[i].next_rest_exp_s
refresh
return
end
end
end
def draw_actor_hp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text_pop_up(x + 32, y, 71, 32, actor.hp.to_s,2)
self.contents.font.color = normal_color
end
def draw_actor_sp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text_pop_up(x + 32, y, 71, 32, actor.sp.to_s,2)
self.contents.font.color = normal_color
end
def draw_actor_exp(actor, x, y)
self.contents.draw_text_pop_up(x, y, 48, 32, 'Exp')
self.contents.draw_text_pop_up(x + 48, y, 55, 32,
actor.next_rest_exp_s.to_s,2)
end
end
#===============================================================================
# Window_Pop_Up_Map
#===============================================================================
class Window_Pop_Up_Map < Window_Pop_Up
attr_accessor :arrow
def initialize
case POP_UP::MAP_LOC
when 0
super(-312,0,312,312,6)
when 1
super(640,0,312,312,4)
when 2
super(-312,168,312,312,6)
when 3
super(640,168,312,312,4)
end
self.contents = Bitmap.new(width - 32, height - 32)
if $game_system.pop_up_map == ''
if FileTest.exist?('Graphics/Pictures/World Map.png')
@picture = RPG::Cache.picture('World Map')
$game_system.pop_up_map = 'World Map'
else
return
end
else
@picture = RPG::Cache.picture($game_system.pop_up_map)
end
@picture_x = 140 - @picture.width / 2
@picture_y = 140 - @picture.height / 2
@arrow = Arrow_Base.new(nil)
@arrow.z = 5100
refresh
end
def refresh
self.contents.clear
#if too big stretch
if @picture.width > 280 || @picture.height > 280
self.contents.stretch_blt(Rect.new(0,0,280,280),@picture,
@picture.rect,200)
else
self.contents.blt(@picture_x,@picture_y,@picture,
@picture.rect,200)
end
end
def update
super
#update picture if different
if @picture != $game_system.pop_up_map
@picture = RPG::Cache.picture($game_system.pop_up_map)
@picture_x = 140 - @picture.width / 2
@picture_y = 140 - @picture.height / 2
refresh
end
#don't update the arrow if it doesn't exist
return if @arrow.nil?
#dispose the arrow if disposing
if @dispose_me
@arrow.dispose
return
end
#only update arrow when completed movement
if @count == @speed
@arrow.update
end
#update arrow location
@arrow.x = self.x + 16 + $game_system.pop_up_location_x + @picture_x
@arrow.y = self.y + 80 + $game_system.pop_up_location_y + @picture_y
end
end
#===============================================================================
# Scene_Map
#===============================================================================
class Scene_Map
alias max_pop_main_later main
alias max_pop_update_later update
def main
max_pop_main_later
#dispose the hud if its active and changing scenes
@pop_up_info.dispose unless @pop_up_info.nil?
@pop_up_stats.dispose unless @pop_up_stats.nil?
@pop_up_map.arrow.dispose unless @pop_up_map.nil?
@pop_up_map.dispose unless @pop_up_map.nil?
end
def update
max_pop_update_later
#info window
unless @pop_up_info.nil?
#dispose if flagged for disposal
if @pop_up_info.dispose_me
@pop_up_info.dispose
@pop_up_info = nil
else
#update the hud
@pop_up_info.update
end
end
#stats window
unless @pop_up_stats.nil?
#dispose if flagged for disposal
if @pop_up_stats.dispose_me
@pop_up_stats.dispose
@pop_up_stats = nil
else
#update the hud
@pop_up_stats.update
end
end
#map window
unless @pop_up_map.nil?
#dispose if flagged for disposal
if @pop_up_map.dispose_me
@pop_up_map.dispose
@pop_up_map = nil
else
#update the hud
@pop_up_map.update
end
end
if Input.press?(POP_UP::INPUT) && $game_system.pop_up_hud_enabled
#create the huds
if POP_UP::INFO && @pop_up_info.nil? && $game_system.pop_up_info_enabled
@pop_up_info = Window_Pop_Up_Info.new
end
if POP_UP::STATS && @pop_up_stats.nil? && $game_system.pop_up_stats_enabled
@pop_up_stats = Window_Pop_Up_Stats.new
end
if POP_UP::MAP && @pop_up_map.nil? && $game_system.pop_up_map_enabled
@pop_up_map = Window_Pop_Up_Map.new
end
end
end
end
Compatibility
This script is not designed for ABS's. If you are looking for an ABS hud your looking in the wrong place.
Screenshot
DEMO
http://www.mediafire.com/?lgzi8f2qxm7lir4
Installation
Paste script above the main and bellow the other default scripts
Credits
Maximusmaxy - For writing the script