Simple Pedometer HUD
Version: 1.1a
Author: cozziekuns
Date: May 2, 2010
Version History
- <Version 1.0> 05.02.2010 - Original Release
- <Version 1.0b> 05.02.2010 - Made the X and Y module
- <Version 1.1a> 05.02.2010 - With the help of Deity and MA, you can now disable the pedometer with Q, and enable with W.
Planned Future Versions
Description
A simple pedometer HUD. The only reason I can see that this could be useful is if you have an item akin to an egg in pokemon, where the item will hatch, break, etc on a specific step count, and you want your player to be able to see how many steps his walked.
Features
- A simple pedometer HUD.
- Updates itself.
- Up to 5 digits, or 99999 Steps before it breaks down.
- Resettable.
- Shows up as a variable.
- Able to disable
Screenshots Instructions
See the header. You can change the modules as you like as well. To reset the pedometer, just set the variable (default is 1) to 0.
Script
#===============================================================================
#
# Cozziekuns' Simple Pedometer HUD
# Last Date Updated: 4/10/2010
#
# A pedometer that counts your steps. It can be reset. The step count is stored
# in the variable 1 by default.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 05/02/10 - Started Script.
# o 05/02/10 - Created the X and Y function on the module.
# o 05/02/10 - Made disabling possible.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Pausing?
# o I dunno. You tell me!
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#===============================================================================
module COZZIEKUNS
VARIABLE = 1 # The variable where the step count is stored
PEDOMETER = "Pedometer" # The text above the step count.
ICON = 48 # The Icon aligned left of the step count.
X = 384 # The X co-ordinate of the window.
Y = 328 # The Y co-ordinate of the window.
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
$game_map.refresh
@spriteset = Spriteset_Map.new
@CozX = COZZIEKUNS::X
@CozY = COZZIEKUNS::Y
@pedometer_window = Window_Pedometer.new(@CozX, @CozY)
@message_window = Window_Message.new
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
if $scene.is_a?(Scene_Battle) # If switching to battle screen
@spriteset.dispose_characters # Hide characters for background creation
end
snapshot_for_background
@spriteset.dispose
@pedometer_window.dispose
@message_window.dispose
if $scene.is_a?(Scene_Battle) # If switching to battle screen
perform_battle_transition # Execute pre-battle transition
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::L)
@pedometer_window.visible = false
end
if Input.trigger?(Input::R)
@pedometer_window.visible = true
end
$game_map.interpreter.update # Update interpreter
$game_map.update # Update map
$game_player.update # Update player
$game_system.update # Update timer
@spriteset.update # Update sprite set
@message_window.update # Update message window
@pedometer_window.update
unless $game_message.visible # Unless displaying a message
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Increase Steps
#--------------------------------------------------------------------------
def increase_steps
super
return if @move_route_forcing
return if in_vehicle?
@variable = COZZIEKUNS::VARIABLE
$game_party.increase_steps
$game_party.on_player_walk
$game_variables[@variable] += 1
end
end
#==============================================================================
# ** Window_Pedometer
#------------------------------------------------------------------------------
# This window displays a pedometer
#==============================================================================
class Window_Pedometer < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, WLH + 64)
@variable = COZZIEKUNS::VARIABLE
refresh
end
#--------------------------------------------------------------------------
# * Step_Count
#--------------------------------------------------------------------------
def step_count
@stepcount = $game_variables[1]
steps = @stepcount
result = sprintf("%05d", steps)
return result
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if $game_variables[2] = 1
text = step_count
texta = COZZIEKUNS::PEDOMETER
self.contents.font.color = system_color
draw_icon(COZZIEKUNS::ICON, 4, 32)
self.contents.draw_text(4, 0, 120, WLH, texta, 1)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, WLH ,text, 2)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_variables[@variable] != step_count
refresh
end
end
end
Credit
Thanks
Support
Just post down here.
Known Compatibility Issues
Seems like it gets in the way of Active Battle System HUD's. Though you could just change the X and Y co-ordinates.
Demo
See attached.
Restrictions