Like a lot of newbies to RPGM3, the concept of how Variables worked confused me. And the more research I did, the more perplexed I became. Finally I opened up the sample game for editing to see how the game did it, and that's how I finally got a basic understanding.
Basically a Variable is an assigned number or ticket. Values can be added or subtracted to this ticket under the property control option in standard events. If you use a certain variable in order to control one event, you can use the number of values attached to that specific variable to do different things
For instance in the sample game, A king asks you to collect 5 stamps to gain a special prize. The command to give you the treasure uses in this case is shared variable 60 and is dependant upon having 5 value points. Everytime you find someone who gives you a stamp, that really is an event assigning 1 point of value to shared variable 60. When you find all 5 stamps, you can go back to the king to get you reward because the conditions to do so have been met.
Here is a simple version of the "Stamp Quest". Basically it ask you to do something to get into a treasure chest and recieve a prize. Actually using a treasure as a key is much quicker, but that's not the point. The point is to help you get a basic understanding by having you create a basic example.
-------------
Exercise: Get a treasure by doing something
----Create New Event 1---
Page 1
-Choose picture of a treasure chest
Page 2
-Choose Event Code box
Event Code Page
-Choose Display-Message Display- Type: You must touch jar to get item
-Choose Control- Val Conditioned Branch- Chose option 2
Val Conditioned Branch Page
-Choose Variable 01
-Top Left Box leave Value = Specific Value
-Top Right Box 123... put 1 (leave second layer of boxes alone)
Event Code Page
-Create command at option 1/end - choose party control - choose obtain items (what item you want) - Choose party member to give item into.
-Create second command- Choose control- Choose Event ending (This stops the event from rehappening.
--- Create New Event 2 ---
Page 1
-Choose picture of jar
Page 2
-Choose Event Code box at bottom
Event Code Editor Page
-Choose Property Control- Choose Increase Shared Value
Increase Shared Value Page
-Choose Variable 01
-123...Box Choose 1
--------------------------------------------------------------------------------------
Now your character should go to the treasure chest to have it say "You must touch jar to get item". Go over to jar and activate that event. Go back to Treasure chest and activate that. Open up the item list in the character that you programed the item to go and it should be there.
----------------------------------------------------------------------------------------
There's even a quicker way to use variables to do the exact same action but this was an example to show you how to use them. Hopefully this has helped you gain a simple understanding to in my opinion a complicated concept to grasp.
Now I hope this thread can be added to by myself and others on different templates that you can use variables for more advanced actions.
Basically a Variable is an assigned number or ticket. Values can be added or subtracted to this ticket under the property control option in standard events. If you use a certain variable in order to control one event, you can use the number of values attached to that specific variable to do different things
For instance in the sample game, A king asks you to collect 5 stamps to gain a special prize. The command to give you the treasure uses in this case is shared variable 60 and is dependant upon having 5 value points. Everytime you find someone who gives you a stamp, that really is an event assigning 1 point of value to shared variable 60. When you find all 5 stamps, you can go back to the king to get you reward because the conditions to do so have been met.
Here is a simple version of the "Stamp Quest". Basically it ask you to do something to get into a treasure chest and recieve a prize. Actually using a treasure as a key is much quicker, but that's not the point. The point is to help you get a basic understanding by having you create a basic example.
-------------
Exercise: Get a treasure by doing something
----Create New Event 1---
Page 1
-Choose picture of a treasure chest
Page 2
-Choose Event Code box
Event Code Page
-Choose Display-Message Display- Type: You must touch jar to get item
-Choose Control- Val Conditioned Branch- Chose option 2
Val Conditioned Branch Page
-Choose Variable 01
-Top Left Box leave Value = Specific Value
-Top Right Box 123... put 1 (leave second layer of boxes alone)
Event Code Page
-Create command at option 1/end - choose party control - choose obtain items (what item you want) - Choose party member to give item into.
-Create second command- Choose control- Choose Event ending (This stops the event from rehappening.
--- Create New Event 2 ---
Page 1
-Choose picture of jar
Page 2
-Choose Event Code box at bottom
Event Code Editor Page
-Choose Property Control- Choose Increase Shared Value
Increase Shared Value Page
-Choose Variable 01
-123...Box Choose 1
--------------------------------------------------------------------------------------
Now your character should go to the treasure chest to have it say "You must touch jar to get item". Go over to jar and activate that event. Go back to Treasure chest and activate that. Open up the item list in the character that you programed the item to go and it should be there.
----------------------------------------------------------------------------------------
There's even a quicker way to use variables to do the exact same action but this was an example to show you how to use them. Hopefully this has helped you gain a simple understanding to in my opinion a complicated concept to grasp.
Now I hope this thread can be added to by myself and others on different templates that you can use variables for more advanced actions.
