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
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi40.tinypic.com%2F9r13l4.png&hash=236b957f01574126d9f0fc40b8d3d4d33240c848)
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
:ccby:
Yeah, it does seem like it has limited uses. It's cool nonetheless :)
Thanks for the positive feedback! Hope someone can find more uses for this then I could.
Well, I think it could be useful for some minigames; for instance, maybe they could make a maze that you only have a limited number of steps to get through it or else you lose; stuff like that.
That's a nice idea, but at the moment I can't find a way to disable the script -.- So using it for a minigame wouldn't be a good idea, unless your willing to have it on for the whole game just for those one or two minigames.
Hay nice idea!
To disable the script you've only to change the visibility of the window.
Use the window-class variable visible = boolean to change the visibility.
Deity
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD
Quote from: harl4101 on May 02, 2010, 06:26:53 PM
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD
Lol no.
Jokes, just move the x, y co-ordinates somewhere else. And if I'm not mistaken, I think Mr Mo's ABS is for RPG Maker XP... This is for RPG Maker VX. Sorry.
@Deity: Great idea! I'll try it now.
Quote from: cozziekuns on May 02, 2010, 06:35:51 PM
Quote from: harl4101 on May 02, 2010, 06:26:53 PM
Is There any way to get rid of stuff on Mr Mo mo's ABS HUD
Lol no.
Jokes, just move the x, y co-ordinates somewhere else. And if I'm not mistaken, I think Mr Moo's ABS is for RPG Maker XP... This is for RPG Maker VX. Sorry.
@Deity: Great idea! I'll try it now.
What line is It On? And Yea Xp :D
Quote from: harl4101 on May 02, 2010, 07:13:01 PM
What line is It On? And Yea Xp :D
Well, I updated it so the X and Y co-ordinates can be changed easily through the module. Still no progress on disabling it though. Killing the opacity doesn't seem to destroy the text, and I don't want to dispose the window, because then it won't be updating constantly...
Why won't:
@pedometer_window.visible = false
work?
Quote from: modern algebra on May 02, 2010, 08:39:23 PM
Why won't:
@pedometer_window.visible = false
work?
Wow, I was doing a lot more than that. It worked in the end. Thanks Deity and Modern Algebra!