Use variables (Beginner Tutorial)
[
Front page
] [
New
|
Page list
|
Search
|
Recent changes
|
Help
|
Log in
]
Start:
''[[Beginner Tutorial INDEX:https://rpgbakin.com/pukiwiki...
*Use variables [#e808a596]
''Let’s build a map where the player jumps to reach treas...
''Jumping adds a fun mechanic to your game, but it also i...
''In this tutorial, we’ll create a puzzle where opening f...
**Building the Cave Map [#g70f71de]
''Modify the cave interior map you added earlier in the [...
''There are four key points:''
1) Raise the outer edges by four layers (increase the Y c...
2) Leave a 3-tile section on the back wall of the cave un...
3) In the unraised area, place "Labyrinth Wall" from [[St...
4) Create five elevated platforms (2x2 tiles in size, 4 l...
Place "treasure chests" from [[Stamps Palette]] > Objects...
We'll use variables to create treasure chests with random...
#ref(./Use variables_1.jpg,40%)
#br
**Variables [#i8a1ec0d]
''Variables are an essential concept in game creation and...
You can think of a variable as a “box”—a named container ...
By referencing the name of the "box" throughout your game...
''Note:'' Storing a value in a variable is called an ''&s...
***Creating a Variable [#y263c138]
''Let’s start by creating a variable to keep track of how...
Open the [[Variable List]] from the master menu on the le...
Under the Normal tab, click the Add button to create a ne...
Click the variable name to rename it to ''“Number of Open...
#ref(./Use variables_2.jpg,40%)
#br
''&size(16){And that’s it — your first variable is now re...
***Treasure Chests With Random Contents [#x0c4bbfc]
''Now let’s create the treasure chest itself.''
''First, select one of the raised platforms and press G t...
Set the event name to “Random Treasure Chest” and the she...
For the event graphic, choose a treasure chest from the r...
Set the Orientation Control to “Fixed.”
#ref(./Use variables_3.jpg,40%)
#br
The event flow will go like this:
''&size(16){Open Chest Animation → Assign Random Number t...
''1. Leave the event trigger as “When Player Talks.”''
''2. Add the “Sounds” category > “Play Sound Effect” pane...
''3. From the Event category, add a Change Event Graphic ...
This completes the chest opening animation.
''4. From the Variable Box category, add an Advanced Vari...
Click on "What".
In the Select Variable Box dialog, go to the Local tab an...
Rename "Local0" to "Random Value."
In the "To What" field, set a random number with Min: 0 a...
For "Do what?", select Assign.
This will assign a random value — 0, 1, or 2 — to the var...
#ref(./Use variables_4.jpg,40%)
#br
''5. Add the “Multi-branch (by Variable Value)” panel fro...
Set “Random Value” as the “Variable Box Number.”
Press the add button inside the panel to create “Conditio...
Set “Condition Value 1” to "0", “Condition Value 2” to "1...
You have now created branches that change according to th...
#ref(./Use variables_5.jpg,40%)
#br
''6.Set the items that can be obtained for each of the th...
First, add the “Status” category > “Increase/Decrease Ite...
Set Item to Medicinal Herb and Quantity to 1.
This means that when Random Value = 0, the player receive...
''7. Below the Increase/Decrease Item panel, add three mo...
From the Control category, add a Wait Specified Time pane...
From the Sounds category, add a Play Sound Effect panel a...
From the Conversation category, add a Display Message pan...
#ref(./Use variables_6.jpg,40%)
#br
''8. Set up the same flow for when Random Value = 1 and 2...
For 1, set the item to Potion. For 2, set the item to Ful...
#ref(./Use variables_7.jpg,40%)
#br
''9. Since the player received an item, update the variab...
Below the End Branching, add a Variable Box Assignment an...
Set it to add 1 to the Number of Opened Chests variable.
#ref(./Use variables_8.jpg,40%)
#br
''10. Finally, we want to mark this treasure chest as "op...
Refer to the page [Creating Events ①] for more details.
From the Switch category, add a Event Switch ON/OFF panel
From the Local tab, create a new event switch called "Ope...
#ref(./Use variables_9.jpg,40%)
#br
''11. Add a new event sheet, name it "Opened", and set th...
#ref(./Use variables_10.jpg,40%)
#br
''&size(16){And that’s it! You’ve now created a treasure ...
***Placing the Treasure Chests [#h9bcdb28]
''Now that you’ve created the treasure chest, select it i...
#ref(./Use variables_11.jpg,40%)
#br
----
''Using variables and branches based on their values is a...
''In this tutorial, we used a random number, but you can ...
''There are several types of variables, each with differe...
''Since the treasure chests are placed on elevated platfo...
''Next, let’s add a jump mechanic so they can access thos...
----
''&size(16){Next: [[Jumping:https://rpgbakin.com/pukiwiki...
''&size(16){Previous: [[Debug Features:https://rpgbakin.c...
----
''[[Beginner Tutorial INDEX:https://rpgbakin.com/pukiwiki...
End:
''[[Beginner Tutorial INDEX:https://rpgbakin.com/pukiwiki...
*Use variables [#e808a596]
''Let’s build a map where the player jumps to reach treas...
''Jumping adds a fun mechanic to your game, but it also i...
''In this tutorial, we’ll create a puzzle where opening f...
**Building the Cave Map [#g70f71de]
''Modify the cave interior map you added earlier in the [...
''There are four key points:''
1) Raise the outer edges by four layers (increase the Y c...
2) Leave a 3-tile section on the back wall of the cave un...
3) In the unraised area, place "Labyrinth Wall" from [[St...
4) Create five elevated platforms (2x2 tiles in size, 4 l...
Place "treasure chests" from [[Stamps Palette]] > Objects...
We'll use variables to create treasure chests with random...
#ref(./Use variables_1.jpg,40%)
#br
**Variables [#i8a1ec0d]
''Variables are an essential concept in game creation and...
You can think of a variable as a “box”—a named container ...
By referencing the name of the "box" throughout your game...
''Note:'' Storing a value in a variable is called an ''&s...
***Creating a Variable [#y263c138]
''Let’s start by creating a variable to keep track of how...
Open the [[Variable List]] from the master menu on the le...
Under the Normal tab, click the Add button to create a ne...
Click the variable name to rename it to ''“Number of Open...
#ref(./Use variables_2.jpg,40%)
#br
''&size(16){And that’s it — your first variable is now re...
***Treasure Chests With Random Contents [#x0c4bbfc]
''Now let’s create the treasure chest itself.''
''First, select one of the raised platforms and press G t...
Set the event name to “Random Treasure Chest” and the she...
For the event graphic, choose a treasure chest from the r...
Set the Orientation Control to “Fixed.”
#ref(./Use variables_3.jpg,40%)
#br
The event flow will go like this:
''&size(16){Open Chest Animation → Assign Random Number t...
''1. Leave the event trigger as “When Player Talks.”''
''2. Add the “Sounds” category > “Play Sound Effect” pane...
''3. From the Event category, add a Change Event Graphic ...
This completes the chest opening animation.
''4. From the Variable Box category, add an Advanced Vari...
Click on "What".
In the Select Variable Box dialog, go to the Local tab an...
Rename "Local0" to "Random Value."
In the "To What" field, set a random number with Min: 0 a...
For "Do what?", select Assign.
This will assign a random value — 0, 1, or 2 — to the var...
#ref(./Use variables_4.jpg,40%)
#br
''5. Add the “Multi-branch (by Variable Value)” panel fro...
Set “Random Value” as the “Variable Box Number.”
Press the add button inside the panel to create “Conditio...
Set “Condition Value 1” to "0", “Condition Value 2” to "1...
You have now created branches that change according to th...
#ref(./Use variables_5.jpg,40%)
#br
''6.Set the items that can be obtained for each of the th...
First, add the “Status” category > “Increase/Decrease Ite...
Set Item to Medicinal Herb and Quantity to 1.
This means that when Random Value = 0, the player receive...
''7. Below the Increase/Decrease Item panel, add three mo...
From the Control category, add a Wait Specified Time pane...
From the Sounds category, add a Play Sound Effect panel a...
From the Conversation category, add a Display Message pan...
#ref(./Use variables_6.jpg,40%)
#br
''8. Set up the same flow for when Random Value = 1 and 2...
For 1, set the item to Potion. For 2, set the item to Ful...
#ref(./Use variables_7.jpg,40%)
#br
''9. Since the player received an item, update the variab...
Below the End Branching, add a Variable Box Assignment an...
Set it to add 1 to the Number of Opened Chests variable.
#ref(./Use variables_8.jpg,40%)
#br
''10. Finally, we want to mark this treasure chest as "op...
Refer to the page [Creating Events ①] for more details.
From the Switch category, add a Event Switch ON/OFF panel
From the Local tab, create a new event switch called "Ope...
#ref(./Use variables_9.jpg,40%)
#br
''11. Add a new event sheet, name it "Opened", and set th...
#ref(./Use variables_10.jpg,40%)
#br
''&size(16){And that’s it! You’ve now created a treasure ...
***Placing the Treasure Chests [#h9bcdb28]
''Now that you’ve created the treasure chest, select it i...
#ref(./Use variables_11.jpg,40%)
#br
----
''Using variables and branches based on their values is a...
''In this tutorial, we used a random number, but you can ...
''There are several types of variables, each with differe...
''Since the treasure chests are placed on elevated platfo...
''Next, let’s add a jump mechanic so they can access thos...
----
''&size(16){Next: [[Jumping:https://rpgbakin.com/pukiwiki...
''&size(16){Previous: [[Debug Features:https://rpgbakin.c...
----
''[[Beginner Tutorial INDEX:https://rpgbakin.com/pukiwiki...
Page: