Trip to the "Forest" (basic mechanics)
Searching for how to create a bot in Telegram with the mechanics of going to the forest? In this article, we will tell you how to create a bot with the mechanics of going to the Forest using @MenuBuilderBot. We will reveal the BASIC principles of the game mechanics of receiving items by the player and damage to the character during a random period of time.
It is important to understand that the basic principles themselves are not enough to create a QUALITY "immersive" GAME, but by understanding the basics - you can apply them to your specific project in the form you need. To create the necessary entourage, the basic game mechanics must be surrounded and justified by a plot scenario, as well as auxiliary functionality (balance replenishment, the presence of different types of balances for different in-game currencies or items, the presence of various ways to formalize the basic mechanics in some scenario-based form, the ability for the user to HIMSELF specify or select individual parameters).
❖ Necessary skills
WARNING: This guide is NOT intended to teach beginners and assumes that you have basic skills in working with the constructor and are READY to create more complex projects. The guide reveals the PRINCIPAL SCHEME of operation of individual game mechanics, in particular the basic PRINCIPLES OF WORKING WITH TIME. If in the process of studying the presented material your basic knowledge turns out to be insufficient, we advise you to study the basics before continuing - we will not teach you "how to create buttons" in this guide.
Despite the fact that the manual is designed for knowledgeable admins, to simplify the initial understanding of the given schemes - they are given IN THEIR MOST BASIC FORM. In the future, having understood the principles of their work, you will be able to complicate them as necessary - such an approach will allow you YOURSELF to form the CORRECT PRINCIPLES OF WORK with new functionality and knowledge - will make it clear that YOU DO NOT NEED TO THOUGHTFULLY COPY the given approaches (and then come to support and say that nothing works and you do not understand anything) - you need to comprehend their principle using simple examples and then, as your understanding grows, move on to more complex application options.
List of required skills:
• Creating Buttons and Messages
• Variables
• Macros
• Balance in the bot
• Conditions
• Actions
• Expressions
• Working with Date and Time
❖ Basic scheme of the trip in to the forest mechanics in the bot
In this scheme:
• The user sends the game character "into the Forest" for a specified time.
• During his trip in the forest, the character can receive game items, as well as damage to health.
• Using items received in the forest allows you to restore the character's health.
Preparatory actions
At this stage, we are preparing the functionality of our bot to create game mechanics.
● You already have the numeric variable «balance» - the user’s Main Balance is stored there.
● Create a Numeric variable «fo_health» - it will store the Character’s Health.
● Create a Numeric variable «fo_mushrooms» - it will store the number of mushrooms (in-game items) found in the forest.
● OPTIONAL - create a Numeric variable «cfo_count» - it will store the number of trips to the forest (needed for creation of TOP of active users).
● Create a Numeric variable «fo_inforest» - contains a "flag" indicating that the Character is in the forest.
● Create a Date and Time variable «fo_back» - it will store the time when the Character returns from the forest.
Entering the game
Initializing the necessary in-game variables.
● Add «Action of Numbers» (sets the initial Health of the Character if the variable is zero)
Variable to change: fo_health
Operation type: Set Value
Value: 100 (one hundred)
Condition: {%fo_health% == 0}
Failure Message: none
Success Message: none
IMPORTANT: This action is mainly needed to demonstrate the approaches described below. Obviously, in a real game, the volume and state of Health will be controlled by separate mechanisms created by you - alternatively, for testing, you can simply set the value in a variable by command for example. Action in this case is used only for simplicity, clarity and to draw attention to the fact that you, as the creator of the game, will REQUIRE to set the Character's Health somewhere at the stage of initializing a new character.
Sending character into the forest
Trip button - sends the Character to the Forest
● Create a «Trip» button with the condition: {%fo_inforest% == 0} and the error message: «The character is already on a Trip».
● Add «Action of Numbers» (sets the return time)
Variable to change: fo_back
Operation type: Set Value
Value: {dt_add(dt_now(), randf(0.05, 0.1))} (random number from 0.05 to 0.1 hours)
Condition: none
Failure Message: none
Success Message: optional
PLEASE NOTE that the length of the character's stay in the forest, IN THIS CASE, is a random number from a given range. This approach is just an example. In your game, you can use any constants, as well as some derivatives of the character's characteristics or the environment in the game world, which will increase or decrease the duration of the hike.
● Add «Action of Numbers» (increasing the counter of trips to the Forest)
Variable to change: fo_count
Operation type: Change Value
Value: 1 (one)
Condition: none
Failure Message: none
Success Message: optional
● Add «Action of Numbers» (setting "flag" that the Character is in the Forest)
Variable to change: fo_inforest
Operation type: Set Value
Value: 1 (one)
Condition: none
Failure Message: none
Success Message: optional
● Add a Message to the button: «The character went to the Forest».
Checking the status
Status check button - allows the player to find out the main game indicators at the moment.
● Create a «Status» button.
● Add «Action of Conditions» (if Character is in Forest)
Condition: {%fo_inforest% == 1}
Failure Message: none
Button Action: SHOW content
● Add «Action of Conditions» (if time is up and character left the Forest)
Condition: {dt_left("%fo_back%") == 0}
Failure Message: none
Button Action: SHOW content
● Add «Action of Numbers» (set a "flag" that the Character has left the Forest)
Variable to change: fo_inforest
Operation type: Set Value
Value: 0 (zero)
Condition: none
Failure Message: none
Success Message: optional
● Add «Action of Numbers» (with a 50% probability we subtract a random amount of Character Health)
Variable to change: fo_health
Operation type: Change Value
Value: {randi(-20, -5)} (random number from -20 to -5 hours)
Condition: {randf(0, 1) <= 0.5} (we set the probability (of the event) of the Action being triggered)
Failure Message: none
Success Message: not required, but for example: «You were bitten - you lose {-1 * %fo_health_v%} Health».
● Add «Action of Numbers» (with a 60% probability we add 1 mushroom to the Character's inventory)
Variable to change: fo_mushrooms
Operation type: Change Value
Value: 1 (one)
Condition: {randf(0, 1) <= 0.6} (we set the probability (of the event) of the Action being triggered)
Failure Message: none
Success Message: optional
● Add a message to the button:
Forest Trip Status.
Character {bool_symb((%fo_inforest% == 0), "has left forest", "is in forest")}
Returns in: {dt_left_hm("%fo_back%")}
Health: %fo_health%
Mushrooms: %fo_mushrooms%
Total trips: %fo_count%
Using a found item
Using the item will increase the character's health by a specified number of points.
● Create an «Eat Mushroom» button with the condition: {%fo_mushrooms% > 0} and the error message: «You don't have any Mushrooms».
● Add «Action of Numbers» (will deduct one Mushroom from the Character's Inventory)
Variable to change: fo_mushrooms
Operation type: Change Value
Value: -1 (minus one)
Condition: {%fo_health% < 100} (if the Character's Health is damaged)
Failure Message: «You have full Health - no healing required»
Success Message: optional
● Add «Action of Numbers» (restores health by 10 points, but not more than 100)
Variable to change: fo_health
Operation type: Set Value
Value: {min(%fo_health%+10, 100)} (set Health to the smaller one of the two values)
Condition: {%fo_health% < 100} (if the Character's Health is damaged)
Failure Message: «You have full Health - no healing required»
Success Message: optional
● Add a Message to the button: «Mushrooms remaining: %fo_mushrooms%».
TOP players
The TOP button allows you to create lists of the best players according to individual parameters.
To create a TOP, you will need the function (by the number of TOPs):
«39. Basic TOP by Variable»
To add feature go to your bot:☞ 🔐Admin | 🧩Extensions | 📂Variables
● Create a «TOP Players» button.
● Add a Message to the button (for TOP by Balance):
The most active players:
1. %topfo_count1u% - %topfo_count1v%
2. %topfo_count2u% - %topfo_count2v%
3. %topfo_count3u% - %topfo_count3v%
4. %topfo_count4u% - %topfo_count4v%
5. %topfo_count5u% - %topfo_count5v%
6. %topfo_count6u% - %topfo_count6v%
7. %topfo_count7u% - %topfo_count7v%
8. %topfo_count8u% - %topfo_count8v%
9. %topfo_count9u% - %topfo_count9v%
10. %topfo_count10u% - %topfo_count10v%
Next TOP update: %topfo_counth%:%topfo_countm%
❖ Options for improving basic mechanics
Additional items
"In the Forest" you can find several items with different probabilities. The easiest way to implement this is to add another similar action with the parameters you need. You can also implement a Balance containing in-game currency. Basically, in-game currency is the same exchange item as everything else (Mushrooms, for example).
Buying and selling items
The game can be expanded with the functionality of selling and buying in-game items. The mechanism itself is fundamentally no different from «Using a Found Item» (see above) - we deduct one resource and adding another. To do this, implement the Balance into the game mechanics, which will contain the Coins available to the Character.
Crafting new items
Based on the mechanics of buying and selling (when one type of asset changes to another type), you can also create a craft of new items that cannot be bought or found. In this case, you deduct values from several variables and add it to the one different - creating a new item this way.