Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

Click here to join us on IRC (#charas on irc.freenode.net)!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • A counter sort of thing
« previous next »
  • Print
Pages: [1]

Author Topic: A counter sort of thing  (Read 3652 times)

Offline Shadow_754

  • Mage
  • Initiate
  • *
  • Posts: 19
  • Vis_Mage
A counter sort of thing
« on: February 18, 2013, 11:25:20 PM »
I am trying to make a sort of "counter" in my game. The way it would work in there are 100 of a hidden item in the game. Whenever you would find one, it makes the counter go up by 1. Once you find a certain amount of the item (5/20/50/75/100), the boy who tells you of the hidden items would give you a prize.

I am at a loss on how to script this, so could someone please tell me how?
« Last Edit: February 18, 2013, 11:35:26 PM by Shadow_754 »
Logged
Topic for my game in progress: The Era of Perfection:

http://www.charas-project.net/forum/index.php?topic=28814.0

Offline Moosetroop11

  • Sage
  • *
  • Posts: 7,398
Re: A counter sort of thing
« Reply #1 on: February 19, 2013, 01:11:25 AM »
You must use 'variables'

Just add 1 to the variable (name it itemCount or something) each time you find one of the items, then have a conditional branch after the finding script which says 'if itemCount is equal to 100' and put your extra stuff in there.
Logged
Maaaaaaaaaaaaaaaaaaaaaaaaaaan I missed this place.

Quote from: drenrin2120
Maaaaaaaaaaaaaaaaaaan I missed you.

Quote from: fruckert
Maaaaaaaaaaaaaaan I missed that welcome.

Offline Prpl_Mage

  • Administrator
  • Sage
  • *
  • Posts: 7,645
  • The Administrator Mage
    • Check out our itch website
Re: A counter sort of thing
« Reply #2 on: February 19, 2013, 07:13:45 AM »
Just as Moose said, variable operation : [hiditemcount] add 1.

So in the event where you pick up the item, add that variable operation to increase the "counter" by 1.

Next up, for the boy. Start of by creating a new variable to check whether or not he have given you that extra item already. Or 5 switches, one for each step.
something like this: 

add a conditional brancha at the top of the boy's page.
if the variable [hiditemcount] >= 100
YES: conditional branch if [givenitem] is < 5
 Yes: give the item, increase variable givenitem by 1.
if the variable [hiditemcount] >= 75
YES: conditional branch if [givenitem] is < 4
 Yes: give the item, increase variable givenitem by 1.
if the variable [hiditemcount] >= 50
YES: conditional branch if [givenitem] is < 3
 Yes: give the item, increase variable givenitem by 1.
if the variable [hiditemcount] >= 20
YES: conditional branch if [givenitem] is < 2
 Yes: give the item, increase variable givenitem by 1.
if the variable [hiditemcount] >= 5
YES: conditional branch if [givenitem] is < 1
 Yes: give the item, increase variable givenitem by 1.
Logged
Cool RPGM Project!
Sprite till you die

Oh my god, this was ...10 years ago...

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • A counter sort of thing
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum