This week’s Smile Game Builder Tutorial #55: Beam Me Up, Scotty! is uploaded. Enter passcodes to teleport to different maps via a teleporter or warp gate event. It’s a bit like the Teleport Mirrors in Might & Magic World of Xeen. Perfect for adding variety to your game!
Smile Game Builder Tutorial #50: Special Edition (Part 1) – Revisiting & Updating Previous Tutorials
Tutorial #50 for Smile Game Builder is up! This "Special Edition" revisits some of my previous tutorials and brings them up-to-date, mostly to take advantage of Common Events.
Incidentally, at 17:28, after "In the next part", is someone else’s voice saying "Yes". It definitely wasn’t me and there were no other sounds or external noises. Did I capture an "anomalous voice" or EVP? What do you think?
The Pumpkin Hunt mini-game was created for Halloween 2017 using Smile Game Builder. It’s just a bit of fun, but this downloadable file also serves as a tutorial to see the techniques I used.
You can download the mini-game and either play it or view the techniques used from Smile Game Builder (or both). The file size is around 10 Mb, so is comparatively small.
I’ve included several Easter eggs as well, references to literature, mythology or movies; some are more subtle than others. Unless, of course, you know your stuff! See if you can find them all for an extra challenge and comment them! (Hint: There are 5!)
You can watch the mini-game in action (a walkthrough) on my YouTube Channel directly or the embedded video below.
Smile Game Builder‘s built-in camera control is a very useful feature, especially when it comes to achieving certain map effects during the game.
Camera Settings VariablesIn Advanced Variables, you can store the values of various camera settings into variables and reference them throughout.
In my tutorial on camera control, I comprehensively go through using the camera in Smile Game Builder, so I won’t dwell on that here.
I’d recommend watching the video first and returning to this article afterward.
As usual, an auto-run synchronize event containing the variables needs to be set up and placed on each of the maps you want to reference the camera settings.
All camera settings are set in one of three ways:
- Game Data: Game Settings is used to create default settings that are then used globally across all maps.
- Map Settings: Each map has individual Map Settings (right-click on the map name and select that option) and change the camera settings to whatever values you want. These override the default settings in Game Data for that map.
- Auto-Run Event: You can set an auto-run triggered once event to change the camera settings manually. When the player enters the map, this event will automatically orientate the map to these settings.
Choose whichever method suits your game’s needs, depending on the effect you want to achieve. The first two methods are "fixed", so the map settings are automatically implemented for the maps. The third method, however, re-orientates towards these settings unless Camera Movement Time is set to 0 (which is instant) in the Camera Control command.
As you’d expect, Camera Settings – X and Camera Settings – Y store the X and Y angles of the camera respectively.
Camera X is governed by the keys for up (R) and down (F) and Camera Y uses the keys for rotating the camera left (Q) or right (E).As an example (shown in Fig. 15), in Normal view on Sheet 1, a Variable Box Check is added to check if the Camera X variable is set to -48. If it is (under Yes), use the Camera Control command to change X’s camera angle to -89 for this example.
Similarly, on Sheet 2, do the same to check if its value equals -89 and reset X’s camera angle back to -48.
Bear in mind, however, that the above example (as with all the examples in this article) only applies to Normal view. Camera angles and their corresponding variables work differently when in First Person view, but I’ll cover that in one of the next tutorials in this series.
Camera XY Minimum and Maximum Values
The value stored in the variable for Camera X won’t go below -35 (which is an isometric view) or above -90 (which is directly overhead).
And for the Camera Y variable value, the range is 0 to 360.
Field of ViewThe Field of View (or FOV) is the telescopic distance in and out from the character. In other words, when you zoom in (with the C key), objects become closer and zooming out (with the V key) results in objects becoming farther away.
With the example in Fig. 16, on Sheet 1 is a Variable Box Check where the Field of View variable is smaller than 4. And if Yes, change the FOV to 0.5 in Camera Control to zoom right in.
On Sheet 2, likewise, if it’s equal to 1, the FOV is reset to 3.5 from within the Camera Control event command.
Note that, as with all instances of decimal fractions in Smile Game Builder, they’re rounded down. And, since the default FOV is 3.5, if you were to use that as a variable value, it would be recalibrated as 3. Hence, in the above example, the variable’s value is set slightly higher. With the Variable Box Check, numbers are either above or below, or equal to, their fixed values; they’re not inclusive, so setting a higher value is good practice anyway.
FOV Minimum and Maximum Values
When zooming in and out with the C and V keys, the range is 0 (really close) and 4 (slightly above).
This only applies to the FOV on the map; it doesn’t apply to any other camera settings for FOV because that’s separate.
DistanceThe camera’s Distance only applies to Normal view. It measures the distance of the camera in relation to the character or a position on the map.
In the example in Fig. 17, I set up a Variable Box Check for checking if the Distance variable is "the same as" 71 (1 above the default distance) and, because in this instance it’s not (under No), the camera moves all the way above the scene and rotates as well. If the operator is set to "smaller" instead, this would return true (under Yes) and it just zooms in with the FOV.
Don’t forget that the Variable Box Check operators don’t include the numbers you set in its Value, so they always have to be one above or below the actual value you want to use.
Camera ModeThe final part is the Camera Mode. This is to check whether you’re playing in Normal or First Person mode to create different effects for each.
A prime example of its use – in conjunction with Player Direction – is my tutorial on creating a Compass HUD that correctly moves with the player depending on whether Normal view or First Person mode is used.
As another example, with First Person mode, you can create an event sequence where the camera quickly rotates behind you (useful to add tension to horror games), which would be useless in Normal mode. For Normal mode, therefore, you’d simply create another appropriate camera effect.
To use it, the Variable Box Check would use the Camera Mode variable, set to the value corresponding to either Normal view (0) or First Person mode (1). Use one or the other, but remember the Yes/No order in the branch. If it’s set to either 0 or 1, that condition then becomes true or false when you switch between modes using the B key, so whatever is under Yes will activate, otherwise, whatever is under No will activate instead.
I generally tend to use 0 (Normal mode) to make it easier to reference. That means, I always know that 0 is Yes and 1 is No. But, of course, it’s a matter of preference as long as you know which is which.
If you use any other value, it won’t run properly because there are only two modes and Smile Game Builder will treat the variable’s value as though it’s a zero, i.e., Normal mode.
I haven’t decided on the topic of the next tutorial in this series yet, as there’s still plenty to cover in Advanced Variables.
That said, I may continue with Camera Settings, but using the variables in First Person mode since they work differently than with Normal view. Although I’d like to go through some of the others first before revisiting this subject, it’s going to be one of those "wait and see" things.
In Smile Game Builder, you can store and reference various character stats via Advanced Variables.
Under Character Information, you can store:
- Experience: A character’s Level and Experience.
- HP and MP: Current and maximum HP and MP.
- Stats: Attack, Defense, Accuracy, Evasion and Agility.
Each stat is stored in a separate variable per character. If you intend on using all of them with a full party, you’d need to reserve 44 variables. And then with each additional recruitable character, you need 11 further variables.
Using Stat Variables
There are many possible applications for Character Information. I’ve already visited several in my Smile Game Builder Tutorials series, but here are a few more.
Creating Stat Based SkillsWhat if you wanted to create stat-based skills, such as Lockpicking or Dodging?
You’d first need to store each stat in a variable (as in Fig. 11) and then create separate skills based on those stats.
I also covered this in Tutorial #29, which deals with using skills with chests.
So, for the first one, Lockpicking, it can be based on Accuracy.
To What? would be the Lockpicking skill itself, How? would be set to the variable assigned to Accuracy, and Do What? would simply be Assign.
The next step for this example would be to create another Variable Box where Lockpicking is divided by the Fixed Value 2 (or whatever number you want for the division). The end result is that Lockpicking is equal to half of the character’s Accuracy.
Using the defaults at Level 1, Sion’s Accuracy is 95. Halved, the Lockpicking skill would be 47 because fractions are rounded down.
DodgeFor the Dodge skill, in this example I’ve based it on Agility and Evasion.
Assign the Dodge variable to Agility (in the same way as with the Lockpicking skill) and add another Variable Box to add Evasion to that.
Evasion is primarily based on armor. Light armor would probably decrease Evasion because it’s easier for weapons to penetrate through. Heavy armor would increase Evasion, as it offers much more protection than light armor.
Thus, Evasion can be a negative number. Cloth armor, for example, since it offers very little protection, might have -3 Evasion. And when this is added to the Dodge skill, it is, of course, subtracted from the total.
You can change the Evasion rates in Stat Modifications for each piece of armor (in the Items tab).
Checking Stats for Success or Failure
Once you’ve set up the variables and skills, the next course of action would be a chance of success or failure.
Smile Game Builder doesn’t have a direct method of comparing one variable with another because the Variable Box Check uses fixed numbers only. This means that we have to use a kind of workaround.Starting with Lockpicking, decide on the percentage of success beforehand. In this case, there will be a 50% chance to successfully pick the lock.
So, Variable Box Check is then used to determine if the Lockpicking skill is greater than the percentage. The Yes branch would, of course, contain the routine for opening the chest successfully. And the No branch would be for its failure.
The events containing this information need to be running automatically synchronized and put on each map you want to reference them.
You can create other stat-based skills in a similar fashion. For instance, Strength could be based on half the character’s Current HP. Or Intelligence could be based somewhat on Maximum MP.
At the moment, you can only store the character stats defined in the Game Data. It’s not possible (yet) to similarly store monster stats, so these would need to be defined separately for each monster on the maps for an ABS or similar system. They would either be fixed values or random numbers and then scaled by multiplying them with character level.
For the next tutorial, I’ll look at variables for Camera Settings and how they can be used for various purposes.
Random NumberEvery game must have an element of randomness to it, not only to add an element of surprise to the game, but also to increase its re-playability.
In Smile Game Builder, assigning a random number to a variable is as easy as setting its minimum and maximum values. So, setting the range between 5 and 100 will do just that and generate a random number between those values.
In fact, you can have negative values in Min., thereby greatly increasing the range and impacting randomness and any operators applied to it.
The maximum ranges are actually between -9,999,999 and 9,999,999, so this gives a pretty good range to work with.
Random Contents in ChestsAlthough there are many uses for random numbers, one notable use is randomizing contents in chests (referencing one of my Tips & Tricks video tutorials, #28, on chests).
You can either use a single sheet with corresponding Variable Box Check branches or multiple sheets with the Event Sheet Conditions set to its variable values. The former is more useful for smaller ranges and the latter is better for a much broader range (as I’ve done in Random Conversation below).
Another use could be for NPCs giving you random items, perhaps as rewards for completing quests. In fact, this same setup can be used as a template for any other event with randomized content.
Random ConversationIn most RPGs, people usually say the same things each time you speak to them. The only time conversations change is usually when certain conditions become true, such as during quest lines.
To add some realism to your game, add randomized conversation snippets. However, to increase the range you can set your "between" values on separate sheets.
Sheet 1 is the "randomizer", triggered once only, with the random number range set in the Advanced Variable Box.
On subsequent sheets, you’d add the conditional minimum and maximum variable ranges with the conversation snippet in its Event Details. The triggers for each of them is When Main Hero Talks; it’ll automatically select the appropriate sheet accordingly.
When you talk to the NPC, they’ll say something more random, based on the randomized number range from Sheet 1.
Random Events or Encounters
For additional dynamic contents, adding random events or encounters will provide an element of surprise, as I did in Tutorial #26.
Doors of Possibility
The random element in games opens the doors of possibility wide open.
"The doors to possibilities are limited only by your imagination and creative flair."
In addition to random treasure, conversation, and encounters, randomness can be used for so many different things; the possibilities are only limited by your imagination and creative flair.
Anything from reading a random passage in a book to displaying a random image to randomizing monster encounters via events can add that uniqueness and unexpectedness to your games. You can also combine random elements, such as using the Environmental Effects Conversation Choices from Tutorial #19 to randomize things that NPCs say about the weather.
I’ll follow this article up with a video tutorial some time later.
In Part 1 of the Variables in Smile Game Builder series, I went through what variables are, the two types of variables (Basic and Advanced) and their roles in Smile Game Builder.
PreambleAlthough I already did a video tutorial on Advanced Variables in Tutorial #11, as a continuation of this series, this is simply a synopsis of all the things you can store in variables, as well as my own findings.
With each section, I’ll try to be as comprehensive as possible in future articles. And I’ll also add links directly to them here as and when they’re finished.
I’m only focusing on Variable Box in the To What? section for now, but will focus on Number Displayed in Variable Box much later. I’m also not going through all of them because these will be covered more in-depth in later parts.
There will also eventually be an index page for all of these articles for easier access to the parts that interest you.
The Fixed Value is exactly that! You can set variables to specific amounts. These can then be manipulated with the operators in Do What?, also with specific amounts.
With Random Number, you can generate a random number between a minimum and maximum value and store the result in a variable. This can then be used in conjunction with the Variable Box Check to randomize contents, rewards, conversation snippets, or even random events.
Unlike the random number operator in Variable Box, which adds a random number to a variable, this gives you the option to create a random number from a range of numbers.
Amount of MoneyExactly as it states, this stores the total Amount of Money you have. You need to set up an auto-run synchronize event trigger for each map you want to check it on.
The money amount itself (in the Increase/Decrease Money section) is a fixed value, so you can’t directly add or subtract anything to or from it through variables.
Instead, you can reference the amount of money you have in messages using \Variable[x], where x is the variable number for the stored money.
Be aware that, as a potential bug I recently found, if you increase or decrease the amount of money in the same event, the variable’s new value may not update to this new value in the message if it’s placed immediately after the increase/decrease. You’ll need to place your message first and then the increase/decrease event command for it to be in sync.
Held Item Number
Store the number of certain items carried in Held Item Number. This is notably useful for any of the Crafting systems I did on my YouTube Channel, where you need specific amounts of ingredients to be able to craft new items.
Character InformationThis allows you to store the values of characters’ stats in variables.
As you can see from Fig. 6, level and experience, current and maximum HP and MP, and so on, can be assigned to variables.
This is particularly useful for some kind of skills system. As an example, lockpicking would be based on Accuracy, dodging traps on Evasion and Agility, and so on. You can then use a comparative percentage variable to check if the stats are high enough.
I’ll go more in depth with math calculations in a future tutorial.
The Map X Size and Map Y Size can be referenced by variables. I have no practical use for this; however, one use could be for a fake windows error message, based on map size.
Map Environmental Effect
Each map can have its own environmental effect (in the Map Settings) – whether rain, snow, confetti, etc. – and using the advanced variables, you can store the Map Environmental Effect.
I did a video tutorial on conversations based on weather. But this can be used for other things as well.
In Part 3
In Part 3, I’ll go into randomization and what you can do with random numbers, including the skill-testing I mentioned before, with a follow-up video tutorial later.
A Variable is simply somewhere to store numbers or values so that they can be referenced later. There are two types of variables in Smile Game Builder: Basic and Advanced.
I’m going to be as comprehensive as possible with this series. However, you can skim through the parts you already know and, as the series progresses, skip to the parts you’d like to know more about.
Basic VariablesBasic Variables are used for simple operations to directly affect the targeted Variable No. with whatever number is set in its Value.
You can assign a fixed value to the variable with Put into variable box as-is. Another value can then be added to or subtracted from this value, or multiplied by or divided by it with another Variable Box referencing it. And this new value is placed into the variable.
Besides the usual math operators, you can also add a random number in variable box between 1 and whatever number is placed in Value up to a maximum 999,999. This does exactly as it states and adds the random number to the variable; it doesn’t create a random number (that’s in the Advanced Variables section).
The basic Variable Box is primarily used for setting up quick, simple variables and manipulating them with the operators.
ALL values are fixed and can’t be directly influenced by other variables. It can kind of be done, but I’ll cover that in a later tutorial.
In the Advanced Variable Box Op. section, you can do much more with variables (as you can see in Fig. 3 below).These are values specific to various parts of the game and they can be stored and manipulated in the same way as basic variables. And we’ll go through each of them over the course of this tutorial.
This is where you set the variable you want to use. The maximum allowed variables in a single game is 999, although you can reuse other established variables on different maps if you’re not using them elsewhere on the same map.
Variable Box is used and referenced the same as in the Basic Variables. There is another option in the dropdown, Number Displayed in Variable Box, but we won’t worry about that for some time.
This section is for selecting the type of operator to use with the variable. In addition to the usual math operators, you (obviously) set the variable’s value with Assign.
There’s one other operator, Substitute Divided Remainder, which divides the variable’s value by the assigned number and uses the remainder as the value. I covered modulo operations already in a previous tutorial.
You can use advanced variables to set "fixed" variables instead of the basic Variable Box. The two are the same and do the same thing.
Personally, I like using the basic Variable Box if my variables are simple values not reliant on anything except for fundamental calculations. And then I use the Advanced Variable Box for more complex operations. It may be just a matter of preference when setting up the basics for more advanced stuff later.
In Variables Part 2
I’ll continue the series in the next article and, over the course of the tutorial, will go through each one in turn. Included will be explanations on how and where they can be used, along with examples as necessary.
I covered Advanced Variables in my video series in Tutorial #11 (as well as some later videos), so aim to expand on that in this series, with additional video references as they crop up.
Although I won’t go into as much detail (except perhaps in a future article), I’ll utilize the event’s Conditions in conjunction with variables. And I’ll share some of the techniques I’ve learned in the process, such as how to properly set up a cut scene using only variables.
So, say you wanted to use the 10’s value from a number, but not the 1’s or any remainders after it, you can extract it as a single value using this function. In this article, variable manipulation uses the Advanced Variable Box Op.
For the purposes of this article, and to see it in action, the first step is to create a variable to generate a random number.
- Use the Random Number command in the Advanced Variables to generate a random number range. The regular Variable Box will just add a random number to the existing number. However, we want to generate a new random number each time.
- Assign a variable with a random number between 0 and 999.
Units or 1’s
To calculate the units, the formula is:
Number % 10
Which simply divides the number by 10 and outputs the remainder.
- Store the random number variable into another variable for the 1’s.
- Add another Advanced Variable Box to modify the 1’s variable to a fixed value of 10, and set the Substitute divided remainder as the operation.
Tens or 10’s
For caluclating the tens, the modulus operation is:
(Number % 100) / 10
- Once again, set a variable for the 10’s to the same as the random number.
- Substitute the remainder with a fixed value of 100.
- And divide the result by 10.
At this point, you may start to see a pattern emerging. This is a surefire way of calculating and outputting much larger numbers…
Hundreds or 100’s
The formula for the hundreds is:
(Number % 1000) / 100
- So, as with the tens, a variable is created, this time for the 100’s, and set to the same as the random number.
- The remainder is set.
- And divide the result by 100.
Thousands or 1000’s
If you’re going to use higher numbers in HUDs, such as for stats, you’ll also need thousands as well.
The modulo operation to calculate this is:
(Number % 10000) / 1000
This is set up in the same way as the previous numbers using the variable to store the 1000’s.
The final product will look like this:
Each time the random number updates, it’ll separate the value into its component parts, returning an integer for the thousands, hundreds, tens and units so that they, in turn, can be used to update graphics referencing the number.
You can check to see if it’s running properly by pressing F5 during playtesting and monitor each variable.
Notes About HUDs
I doubt you’ll need more than the 1000’s for creating HUDs because if numbers exceed the maximums, they won’t go above that. The only exceptions are probably experience and gold. If you’re determined on using these in a HUD, then following the same pattern by adding zeros to numbers (as seen above).
I won’t go into actually creating HUDs here, as that would take an entire tutorial – perhaps more than one – to cover fully. However, perhaps I will some time in the future.
There are a number of issues with HUDs, notably when numbers refresh on the map. They tend to flicker on-screen, which is distracting and annoying. This is primarily due to the way that SGB uses and synchronizes auto-running events. It cycles through each one until conditions are true, but removes and then replaces the graphical numbers according to those conditions.
Additionally, each true condition overrides the previous ones, so another anomaly occurs with trailing zeroes. As an example, if your value is three digits long, the output on-screen should be 000. However, if the number is 7, the preceding zeros are displayed as blanks.
There is, of course, a workaround for this, but it isn’t reliable or efficient. I’ll put that in another tutorial some time in the future when, hopefully, I’ll have a proper fix for it.