Guest Access
Go to page : 1, 2
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
Here's a nifty little script that's got some 'multipurpose' going on...
It's basically a counter that can be used for many things,
for example I've set it up to be a Life counter with a tutorial
so that you can setup your RMXP projects to have a Lives System.
(instead of GAME OVER when your health reaches 0)
It has the options to display text and an icon
next to your counter.
easy to position and to disable display.
requires 1 variable
1 script
and some events
enjoy!
Script:
Demo:
Alpha Platform Demo
It's basically a counter that can be used for many things,
for example I've set it up to be a Life counter with a tutorial
so that you can setup your RMXP projects to have a Lives System.
(instead of GAME OVER when your health reaches 0)
It has the options to display text and an icon
next to your counter.
easy to position and to disable display.
requires 1 variable
1 script
and some events
enjoy!
Script:
- Spoiler:
- Code:
################################################################################
#
# NAME + ICON + COUNTER Script
# (with how to setup lives tutorial)
# by gameface101
# 10-17-09
#
# *special thanks to Stephane Roys, "Royer"
# for his original idea LE SCRIPT COMPTEUR 2007
#
# now you can easily make counters that use variables for:
# lives, ammo, coins, keys, party members, special items, etc...
# (simply copy and replace "Life" and "life" with "Coin" and "coin")
#
#######################[ HOW TO USE STEP BY STEP TUTORIAL]######################
#
# Instructions:
#-------------------------------------------------------------------[How To Use]
# step 1 - "copy and paste this script" above your Main script in your
# script data base (to access simply press F11 in your RMXP project)
#
#-------------------------------------------------------------------------------
# step 2 - "copy over the icon" you wish to use in your graphics/icon folder.
#
#-------------------------------------------------------------------------------
# step 3 - "create an event" on the map where the player will start.
#
#-------------------------------------------------------------------------------
# step 4 - "choose a variable" to control your life counter.
#
# double click in the 'List of Event Commands' window to call your
# 'Event Commands' options...now click on tab '1'
# select the 'Control Variables' command under the top right.
# in the 'Variables" box use the drop down box to select the variable
#
# (o) Single [__________________] >
#
# label the variable you have chosen and click 'OK'
# and since there is no need to include the variable in this event,
# just click 'cancel' to go back to the 'Event Commands' options
# for the next step.
#
#-------------------------------------------------------------------------------
# step 5 - "configure event
#
# in the 'Trigger' box click on parallel process
# double click in the 'List of Event Commands' window to call your
# 'Event Commands' options...now click on tab'3'
# select the call 'Script' command on the bottom right and enter the
# script command:
#
# $Life = Life.new(x,y,V,"I","T")
#
#------------------------------------------------------------------=[script key]
# x = horizontal position
# y = vertical position
# V = variable_ID
# I = name of the icon graphic in your "graphic/icons" folder
# T = text displayed
#-------------------------------------------------------------------=[example 1]
#
# example 1.) if you want to use this near the bottom right of the screen
# using variable number 10
# with an icon graphic named person
# displaying the word HERO
#
# then you would enter:
#
# $Life = Life.new(600,400,10,"person","HERO")
#
#-------------------------------------------------------------------=[example 2]
#
# example 2.) if you want to use this near the top left of the screen
# using variable number 25
# with an icon graphic named man
# displaying the word PLAYER 1
#
# then you would enter:
#
# $Life = Life.new(20,10,25,"man","PLAYER 1")
#
#-----------------------------------------------=[Complete the Parallel Process]
#
# Now double click in the 'List of Event Commands' window to call your
# 'Event Commands' options again...click on tab '1'
# select the 2nd command under the top right 'Control Self Switch'
# Select "A" and in the 'Operation' box and set to 'ON' then click 'OK'
#
# Finally click on 'New Event Page' then check the 'self switch' box
# on the second page and then click 'OK'
#
# Alright! now your're all set up! ^,^
#
#=======================================================[How to Control Counter]
#
# To control the amount of lives
# simply use events to control your selected
# 'Control Variable'
#
# Variable Example 1.) 10
#
# Variable Example 2.) 25
#
# Step 1.) "create a new event" to erase the Life + Icon Counter
#
# double click in the 'List of Event Commands' window to call your
# 'Event Commands' options...click on tab '1'
# select the 'Control Variables' command under the top right.
# in the 'Variables" box use the drop down box to select the control variable
#
# (o) Single [__________________] >
#
# in the 'Operations' box select 'Set'
#
# in the 'Operand' box select constant
# now control the amount of lives by setting the value.
#
# click 'OK'
#
#==================================================[Game Over When Out of Lives]
#
# To setup GAME OVER when player runs out of lives go into your 'Data Base'
# (to access simply press F9 in your RMXP project)
#
# click on the 'Common Events' tab
# select a number on the left column
# then label it in the 'Name' box
# call it 'Out of Lives'
# set Trigger to 'none'
# now double click in the 'List of Event Commands' window
# select the 8th option on the left 'Conditional Branch'
# click on tab '1'
# select your chosen variable (as in example 1 and 2)
# (o) 'Variable' [__________________] >
# underneath set [__________________] V to 'Less than or Equal'
# now set your Constant to Zero
# (o) 'Constant' = 0
# click 'OK'
# now double click in the 'List of Event Commands' window again.
# click on tab '3'
# select the 13th option near the bottom right 'GAME OVER'
# click 'OK'
#
# now you will go straight to Game Over when your Life Variable Equals Zero!
#
#==================================================================[How To Hide]
# To hide the counter simply use: $Life.off in another event.
#
#
#
#
####################[THE NAME + ICON + COUNTER SCRIPT]##########################
FONT="Impact"#------------------------------------------------------=[FONT TYPE]
SIZE=28#------------------------------------------------------------=[FONT SIZE]
COLOR=Color.new(255,255,255,255)#----------------------------------=[FONT COLOR]
#-----------------------------------------------------------------------=[CLASS]
class Game_Party
attr_accessor:life
alias life_game_party_initialize initialize
#-----------------------------------------------------------=[DEFINE INITIALIZE]
def initialize
life_game_party_initialize
@life=[]
end
end
#-------------------------------------------------------=[SET CLASS FOR COUNTER]
class Life
attr_accessor:x #---------------------------------=[X COORDINATES FOR COUNTER]
attr_accessor:y #---------------------------------=[Y COORDINATES FOR COUNTER]
attr_accessor:var #--------------------------------------------=[VARIABLE USE]
attr_accessor:value #---------------------------------=[VALUE OF VARIABLE USE]
attr_accessor:icon #-------------------------=[ICON DISPLAYED NEXT TO COUNTER]
attr_accessor:text #----------------------------=[TEXT DISPLAYED NEXT TO ICON]
attr_accessor:no_lives #-------------------------------------=[END OF COUNTER]
#--------------------------------------------=[DEFINE INITIALIZE WITH ARGUMENTS]
def initialize(x,y,var,icon,text)
@x=x;@y=y;@var=var;@icon=icon;@text=text
@no_lives=false
$game_party.life.push(self)
@visible=true
@value=$game_variables[@var]
end
#---------------------------------------------------------------=[DEFINE UPDATE]
def update
@value=$game_variables[@var]
end
#------------------------------------------------------------------=[DEFINE OFF]
def off
@no_lives=true
end
end
#--------------------------------------------------------=[UPDATE GRAPHIC CLASS]
class Spriteset_Map
alias life_spriteset_map_initialize initialize #-=[ALIAS METHOD FOR SPRITESET]
alias life_spriteset_map_dispose dispose #---=[ALIAS METHOD TO DISPOSE SPRITE]
alias life_spriteset_map_update update #--=[ALIAS METHOD FOR SPRITESET UPDATE]
#-----------------------------------------------=[DEFINE INITIALIZE FOR COUNTER]
def initialize
@life_sprite=[]
for life in $game_party.life
setup_life(life)
end
life_spriteset_map_initialize
end
#------------------------------------------------=[DEFINE SETUP FOR LIFE SYSTEM]
def setup_life(life)
sprite=Sprite.new #-----------------------------------------=[CREATE SPRITE]
sprite.bitmap=Bitmap.new(24+3*SIZE+life.text.size*SIZE,[SIZE,24].max)
bitmap=Bitmap.new(24,24)#-----------------------------------=[
bitmap = RPG::Cache.icon(life.icon) #-----------------------=[
sprite.bitmap.blt(life.text.size*SIZE,0,bitmap,Rect.new(0,0,24,24))
sprite.bitmap.font.color= Color.new(0,0,0)
sprite.z = 3000
sprite.x = life.x
sprite.y = life.y
sprite.bitmap.font.name = FONT
sprite.bitmap.font.size = SIZE
sprite.bitmap.font.color = COLOR
sprite.bitmap.draw_text(0,0,life.text.size*SIZE, [SIZE,24].max,life.text,0)
@life_sprite.push(sprite)
end
#------------------------------------------------=[DEFINE SETUP FOR LIFE SYSTEM]
def update
life_spriteset_map_update
for key in @life_sprite.size..$game_party.life.size-1
setup_life($game_party.life[key])
end
#------------------------------------------------=[DEFINE SETUP FOR LIFE SYSTEM]
delete_sprite=[]
delete_life=[]
for key in 0..$game_party.life.size-1
life=$game_party.life[key]
sprite=@life_sprite[key]
life.update #-------------------------------------------=[UPDATES COUNTER]
sprite.bitmap.clear
bitmap=Bitmap.new(24,24)
bitmap = RPG::Cache.icon(life.icon)
#adjust the ICON location (0=x position, 0=y position, 24,24 = window size)
sprite.bitmap.blt(life.text.size*SIZE,0,bitmap,Rect.new(0,0,24,24))
#adjust the TEXT location (30 = X, 0 = Y)
sprite.bitmap.draw_text(30,0,life.text.size*SIZE, [SIZE,24].max,life.text,1)
#adjust the COUNTER NUMBER here => -24,0 (-24 = X, 0 = Y, )
sprite.bitmap.draw_text(life.text.size*SIZE-24,0,life.value.size*SIZE, [SIZE,24].max,life.value.to_s,1)
if life.no_lives
delete_sprite.push(sprite)
delete_life.push(life)
end
end
for sprite in delete_sprite
sprite.dispose
@life_sprite.delete(sprite)
end
for life in delete_life
$game_party.life.delete(life)
end
end
#---------------------------------------------------------------=[ERASE COUNTER]
def dispose
life_spriteset_map_dispose
for sprite in @life_sprite
sprite.dispose
end
end
end
Demo:
Alpha Platform Demo
Administrator
Show Signature
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
profile
calvin624
profile
Great script Gameface, hope all is well - keep up the fantastic work!
Tutorial Wizardmaster
Show Signature
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@calvin - so far all has been busy, that sometimes I forget to eat
but busy is good, most of the time if you're making progress...
enjoy the script and it's many uses ^,^
alright you got your avatar up!
(the shield is bad@$$)
but busy is good, most of the time if you're making progress...
enjoy the script and it's many uses ^,^
alright you got your avatar up!
(the shield is bad@$$)
Administrator
Show Signature
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
profile
I know right, I'm sorry it's over but what a way to go!
GO EAT SOMETHING - don't want you dying on us haha, we need more great scripts!!! ... oh and we like you too hehe
Calvin624
calvin624
profile
gameface101 wrote:alright you got your avatar up!
(the shield is bad@$$)
I know right, I'm sorry it's over but what a way to go!
GO EAT SOMETHING - don't want you dying on us haha, we need more great scripts!!! ... oh and we like you too hehe
Calvin624
Tutorial Wizardmaster
Show Signature
Community Moderator
Community Moderator
Community Moderator
profile
GeMinEye
profile
I've heard of the shield. I never got to watch it though. Still good avatar, hope to see more posts.
EDIT: If you are hungry you could make some ramen.
EDIT: If you are hungry you could make some ramen.
Community Moderator
Show Signature
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
profile
calvin624
profile
@Gemini - Yeah the Shield is one of my favourite tv programs, along with Curb Your Enthusiasm. Don't wanna hijack this thread with all my tv talk lol - it's a great script!!!
Tutorial Wizardmaster
Show Signature
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@calvin - I'm sayin' this script has multipurpose all over it haha
and that's just GeM?N!'s way of stayin on topic...
( with the last post X-P )
man don't get me started on 'curb your enthusiasm!'
that show just makes a mockery out of life...
down right hilarious! Tourettes was all bad haha!
as for this script we can easily use this for the "access cards"
for the FUTURE project ^,^
and that's just GeM?N!'s way of stayin on topic...
( with the last post X-P )
man don't get me started on 'curb your enthusiasm!'
that show just makes a mockery out of life...
down right hilarious! Tourettes was all bad haha!
as for this script we can easily use this for the "access cards"
for the FUTURE project ^,^
Administrator
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
profile
mely
profile
syntax error.. damn v.v
do anyone have an example for this script?
do anyone have an example for this script?
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
yo mely - welcome to the underground ^,^
I could dust this one off and make a demo...
what exactly is the error your are getting?
I could dust this one off and make a demo...
what exactly is the error your are getting?
Administrator
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
profile
mely
profile
I have some problems with my school english and some things in this manual I miss understand
ACTIVATED
Show Signature
ACTIVATED
Go to page : 1, 2