TyranoBuilder Visual Novel Studio

TyranoBuilder Visual Novel Studio

Not enough ratings
[TUTORIAL] How to Make an Inventory System in Tyranobuilder
By JoshPocalypse
It is very difficult to find simple how-to instructions on creating an inventory system in Tyranbuilder. If you are not very code-minded like myself, this should help get you started.
   
Award
Favorite
Favorited
Unfavorite
Start
This is mostly info from these forums and from videos on youtube. I am an artist not a programmer so it took me a while to figure out and piece together the info and I'm sure I am not the only one who feels completely lost trying to figure this stuff out, so I want to make a simple clear guide on how to do some of these things.

Let's start.

To make an Inventory system let's start in your scene where you want to be able to press a button to go to inventory. We will call it scene1. You call it what you want.
Add a tyranoscript box, I like to put it after I clear images or text and before the background image and it works just fine. This will place a button to take you to your inventory screen.
In the tyranoscript box put in this code:

[button name="inventory" role=sleepgame graphic=inv_button.png enterimg=inv_button_hover.png storage=inventory.ks target=*inventory x=425 y=225 width=100 height=30 ]



The "inv_button.png" should be changed to whatever your image is called that you will use for your inventory button. I also have a hover image for my button, but if you don't you can just take out "enterimg=inv_button_hover.png" and it will work just fine. The "x=425 y=225 width=100 height=30" part is where and how large the button will be.
You can place this code in a tyranoscript box in the same place in every scene you want to be able to access your inventory page.

Next, make a new scene titled "inventory".
Remove the Text box and add a Page Break, followed by Remove Images, Remove Text, so that you don't get stuff you don't want in there.
Place a Tyranoscript box next, and put in this code:

[button name="return" graphic=return_button.png enterimg=return_button_hover.png storage=inventory.ks target=*InvEnd x=425 y=525 width=100 height=30 ]

Again, the "return_button.png" should be changed to your image file name or change your file to this one if you like. This code will place a button to return to where you left off in the game. But not quite yet, so stick with me.



Next, is where I place my background image for my inventory UI. Mine is simple in that all the images for resources like food or fuel or stone, are part of the background image so I haven't worked on any calling images to be displayed in your inventory for this tutorial. I will make another one when I get to that point, but this will at least get you over a few hurdles as far making an inventory goes.
Since I have my image for fuel as part of my UI Background image I only need to display how many fuel I have.



First I want to make a variable for fuel. Go to Project>>Variables, and create a variable for whatever you need to track, Food, fuel, Taylor Swift tickets, whatever. Put in '0' for amount that you start with unless you want more than you do you.
Next you need to add an Add Text box from EFFECTS category, NOT Story category. It's the blue Add Text box NOT the pink Add Text box.
In the "Text" box put:

&[f.fuel]

or

&[f.whateveryourvariableis]

Then just resize and position it next to the image and you've got an active tally on that item.
Do this for every item you want to count in your inventory.



Next, place a Stop.
Then, place a Label. I called this label InvEnd in the code, so if you call it that you don't have to change it in the code, otherwise call it what you want but remember the "target=*InvEnd" part of the code needs to be the same.
after the InvEnd label, place a Tyranoscript box. In that box place this:

[awakegame]



Finish
Now you should have a working inventory page that jumps you back to whatever place in whatever scene you came from.

The same code can be used for a map page as well or any other page that you need to access from anywhere and return to where you left.