It is a good idea to have a basic knowledge of
variables before this tutorial, but it is pretty simple and I will
try to describe everything as well as I can.
Start by making a variable called "coins".
That's simple enough, right?
Now for how to earn the coins. Make a new event on
the map someplace, and make it a tree or a rock or anything you
wish. Make sure it is at the same level of the hero, and it's a push
key event. In the Event Commands area, add a variable (page 1,
Change Variable). Make sure the variable is "coins", and
check the +, and under Operand click on Set and write in the number
for how many coins you want to receive. Then have a message saying,
"You gained some coins!"
Now to show how many coins you have. Make another
event, a stone or rock or whatever you want again. Make it the same
level as the hero and a Push Key command. In the events box, write a
message saying, "You currently have \V[#] coins!" (the \V[#] stands
for which variable. Make sure it is the number for the coins
variable.)
Now the hardest part, how to buy items with the
coins. Make another event as a picture of a human, and make it same
level as hero and a Push Key command. Now insert the following
(don't worry, I'll describe it below):
<>Messg:This is the magic shop. What interests
you? <>Show Choice: Potion (5
coins) :[Potion (5 coins)]
Case <>FORK
Optn:Varbl[####:coins]-5abov <>Messg:There
you go, one
item. <>Add/Remove
Item:Potion-> 1
incr. <>Variable
Ch:[####:coins] - ,
5 <>
:ELSE Case <>Messg:Not
enough
money! <> :END
Case <> :CANCEL
Case <> :END Case <>
Steps: 1. Write a message. 2. Use the show
choice command on page 1. For the first choice, type in Potion (5
coins). 3. Under the Potion case, insert a Fork on page 3. Set it
to variable, and select the coins variable. Select Set and set it to
5, and make the select box say above. 4. Write a message. 5.
Use Add Item... on page 1. Set it to Add Item, set Fix to Potion,
and under Operand set it to 1. 6. Use the Change Variable button
on page 1 and select the coins variable. Under set, select -. Under
operand, set it to 5. 7. Write a message under the ELSE Case.
And that's all for one item. To make a second item,
just play around with fork conditions and so forth. That's the only
way you can learn ; ).
|