LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

Administrator
Administrator
#1 default RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
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:

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:
[You must be registered and logged in to see this link.]
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Tutorial Wizardmaster
Tutorial Wizardmaster
#2 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

calvin624

calvin624
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
profile
Great script Gameface, hope all is well - keep up the fantastic work! [You must be registered and logged in to see this image.]
Tutorial Wizardmaster
Show Signature
Tutorial Wizardmaster
http://xasabs.com
Administrator
Administrator
#3 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
@calvin - so far all has been busy, that sometimes I forget to eat silent
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
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
Tutorial Wizardmaster
Tutorial Wizardmaster
#4 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

calvin624

calvin624
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
profile
gameface101 wrote:alright you got your avatar up!
(the shield is bad@$$)

I know right, I'm sorry it's over Sad but what a way to go! Smile

GO EAT SOMETHING - don't want you dying on us haha, we need more great scripts!!! ... oh and we like you too Very Happy hehe

Calvin624
Tutorial Wizardmaster
Show Signature
Tutorial Wizardmaster
http://xasabs.com
Community Moderator
Community Moderator
#5 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

GeMinEye

GeMinEye
Community Moderator
Community Moderator
Community Moderator
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. Razz
Community Moderator
Show Signature


Check out my story:
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]


Community Moderator


[You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.]
WE WILL RULE THE WORLD!
Community Moderator
http://dezrealah.tumblr.com/
Tutorial Wizardmaster
Tutorial Wizardmaster
#6 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

calvin624

calvin624
Tutorial Wizardmaster
Tutorial Wizardmaster
Tutorial Wizardmaster
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
Tutorial Wizardmaster
http://xasabs.com
Administrator
Administrator
#7 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
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 ^,^
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#8 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

mely

mely
ACTIVATED
ACTIVATED
ACTIVATED
profile
syntax error.. damn v.v
do anyone have an example for this script? Embarassed
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#9 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
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?
Administrator
Show Signature


Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]




G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this image.]


shhh.... [You must be registered and logged in to see this link.]



[You must be registered and logged in to see this link.]
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#10 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

mely

mely
ACTIVATED
ACTIVATED
ACTIVATED
profile
I have some problems with my school english and some things in this manual I miss understand Rolling Eyes Embarassed
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#11 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
Cool - no worries, I'm sure your English is much better than my Deutsch.

give me some time to make a demo...
Administrator
Show Signature


Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]




G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this image.]


shhh.... [You must be registered and logged in to see this link.]



[You must be registered and logged in to see this link.]
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#12 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

mely

mely
ACTIVATED
ACTIVATED
ACTIVATED
profile
Thank you very much =)
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#13 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
I once was working on a platform project which then turned into GPLAT...

here's an early platformer demo which used the counter script, hope this helps

^,^


[You must be registered and logged in to see this link.]

*added to original post
Administrator
Show Signature


Hey Guest, check out my demos!
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]




G101's theme colors
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this image.]


shhh.... [You must be registered and logged in to see this link.]



[You must be registered and logged in to see this link.]
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#14 default Re: RMXP = LIFE COUNTER + TUTORIAL
Loading

mely

mely
ACTIVATED
ACTIVATED
ACTIVATED
profile
that was to much.. now I must search what I need Rolling Eyes

Edit: have found it.. omg so easy don't know where was my mistake Embarassed

Edit2: How can I display "Picture" numbers.. and not this text?
As example the "Ihud_Number" graphic from the one script.
ACTIVATED
Show Signature
ACTIVATED

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled