Lives System by Constance Version: 1.0
Aug 10 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
Introduction
A quick script I made before I forgot the idea. Just a simple lives system shown on your map. You can add lives and remove lives. Once it gets to 0, game over. You can even call the gameover command from an event, and the process will still be the same.
Features
Add Lives (multiple if you like)
Remove Lives (multiple if you like)
Call Gameover Command and process is still the same
After Battle process is still the same
Once you reach 0 lives, all looping will break itself, and therefore any commands you press will be invalid.
Set Default number of lives
Set "Gameover Level" (0 by default)
Show on map at all times
Have negative lives (don't know why you would want it though)
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Lives System') == true
#==============================================================================
# ** Game Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :lives
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias con_livessystem_gameactor_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Orginal Initialization Method
con_livessystem_gameactor_init
# Default Lives
@lives = 3
end
#--------------------------------------------------------------------------
# * Add Lives
#--------------------------------------------------------------------------
def add_lives(n)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Sets n value
$game_party.lives += n
end
#--------------------------------------------------------------------------
# * Remove Lives
#--------------------------------------------------------------------------
def remove_lives(n)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Sets n value
$game_party.lives -= n
end
end
class Interpreter
#--------------------------------------------------------------------------
# * Game Over
#--------------------------------------------------------------------------
def command_353
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Set Local Variable Value
$game_party.lives -= 1
end
end
#==============================================================================
# ** Scene Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias con_livessystem_scenemap_main main
alias con_livessystem_scenemap_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Set Wait Count
@wait_count = 15
# Set Phase for Trigger
@phase = 2
# Set Window Lives
@window_lives = Window_Lives.new
# Call Original Method
con_livessystem_scenemap_main
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Updates Window Lives
@window_lives.update
# Refresh Window Lives
@window_lives.refresh
# Call Original Method
con_livessystem_scenemap_update
# Check Wait Count for 0 Lives and Call Gameover Flag
case $game_party.lives
when 0
# Decrease Wait Count
@wait_count -= 1
# If Wait Count is 8
if @wait_count <= 8
# Prepare for transition
Graphics.freeze
# If Wait Count is 0
if @wait_count <= 0
# Set game over flag
$game_temp.gameover = true
# Return true
return true
end
end
end
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Instructions
To install, simply copy and paste this above your Main Script. Be sure you also have the SDK latest version (1.5), as it is needed.
Adding Lives
To add a life, simply use this code in an event's script editor.
Code:
$game_party.add_lives(1)
or:
Code:
$game_party.lives += 1
Whichever one works for you.
You can change that number to whatever amount of lives you want to give a character.
Removing Lives
To remove a life you can use either one in an event's script editor.
Code:
$game_party.remove_lives(1)
or:
Code:
$game_party.lives -= 1
Replace the 1 with the number of lives you want removed.
You can also remove as an extra bonus use the Gameover command, and it will in fact remove 1 life for you.
Be sure when your calling a battle to make it a win/lose condition so that you may remove 1 life (if you want) in that battle.
FAQ
How do you increase the default lives?
At line 39. You can change it there.
How can I change the number my gameover screen will appear?
At lines 154 and 155 you will see this:
Code:
case $game_party.lives
when 0
Replace the 0 with the number you want to be the "gameover level".
Compatibility
SDK. That's it for now.
Credits and Thanks
My brain...I finally got the time to do a script. First one in a long time. But it was a spare of the moment before I forgot.
Author's Notes
More and better releases of this will be coming soon. Just sit tight. Enjoy.