Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Shadow_754 on February 18, 2013, 11:25:20 PM

Title: A counter sort of thing
Post by: Shadow_754 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?
Title: Re: A counter sort of thing
Post by: Moosetroop11 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.
Title: Re: A counter sort of thing
Post by: Prpl_Mage 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.