TyranoBuilder Visual Novel Studio

TyranoBuilder Visual Novel Studio

Ace Apr 5, 2020 @ 9:43am
informative inventory/image gallery help
Hello!

I am crafting an information inventory by creating a scene (let’s call it log.ks) and filling it with image buttons that give you a description of the image when clicked, then jumps back to the beginning of log.ks to make all the image buttons available again. However, I only want an image button to be available if the item has already been discovered in my game. I have already assigned variables to my images so that when all available ones in a scene are clicked it moves onto the next thing, using this code:

[if exp="(f.var1==1 && f.var2==1 && f.var3==1 && f.var4==1 && f.var5==1 && f.var6==1)"]
[jump target=*NEXT]
[else]
[endif]

The way this works is that after clicking an image, it’s assigned variable changes from 0 to 1 and then jumps back to a label that allows all images to be clicked again, and when they have all been clicked at least once it skips to NEXT, which triggers a jump to the next scene.
Is there a way I can alter the code for my inventory scene page so that when the image is clicked and the variable now equals one instead of zero, it can also make the image button available/visible in log.ks?

I know there are image galleries but I don’t think there’s an option to click the images and activate a descriptive text box, otherwise I’d just be able to use the “unlock image” function. I tried creating an image gallery and then editing it using scene editor to make the images clickable, but it didn’t work. Maybe I can make my desired Phoenx Wright-esque inventory with the image gallery, but I’ve read the instructions for creating one so many times and just can’t seem to make it do what I want.

I also want to have an image button in every scene that allows you to access the inventory at anytime and then return to where you were when you clicked it after you exit, if you have any idea how I can do that (I’m guessing with the call/return buttons? Is there a way to do that without having to set a call/return option for every line? I feel like it’s doable but am not sure how to go about doing it)

Any help/advice would be immensely appreciated, thank you for taking the time to read this!
< >
Showing 1-6 of 6 comments
Shimmersoft Apr 5, 2020 @ 12:57pm 
You might take a look at one of our games, RE4: Otome Edition, which features an inventory system, to see if it's something like you're thinking about.

Game Link: https://shimmersoft.itch.io/re4-otome

Screenshot 1: https://www.dropbox.com/s/jgul3f8evae9nsj/Screenshot%202020-04-05%2015.03.10.png?dl=0

Screenshot 2: https://www.dropbox.com/s/mdj5zjgv0o7hbad/Screenshot%202020-04-05%2015.03.19.png?dl=0

Similar to your imagined setup, there are slots for image buttons that only appear if a condition has been met, and clicking on an image button opens flavor text about the item. I'll describe some of the basic elements for this and you can tell me whether that gets you closer to your vision.

1) How to access: You want a button on your game screen that's connected to role=sleepgame. I've done various posts explaining the feature in detail, so you might search through my post history for more info, but it basically looks like this:

[button name="inventory" role=sleepgame storage=inventory.ks target=*begin x= y= width= height= ]

The idea here is that you'll have a perpetual button that will pause your game and jump to the inventory screen. When using sleepgame, you'll need to start the scene with "clearance" material to clear out any elements from your main game (these will be "restored" when the game awakens). Here's some of what I have in RE4:

[nolog]
[playse storage=misc/inventory_enter.ogg volume="&[f.sfxvolume]" loop=false clear=false buf=5]
[bg storage=all-purpose-bgs/Black-Screen.jpg time=10]
[free_filter]
[stop_keyconfig]
[cm]
[clearfix]
[clearstack]
[er]
#
[layopt layer=1 visible=true]
[freeimage layer=0]
[freeimage layer=1]
[freeimage layer=2]
[freeimage layer=3]
[freeimage layer=4]

To return to your game, you need to have the system jump to a label and put [awakegame] in a tyranoscript block. You'll have to do a similar clearance when leaving the scene so that inventory elements don't remain. Hide/Unhide screen will probably be useful to you here.

2) For clicking items, I have a) an in-game variable representing each item and b) a variable specifically for "inventory choice" (to indicate which one the user wants to see). To make an item show, each one gets an if statement:

[if exp="f.inv_note==1"]
[image name="note" storage=default/inventory/note.jpg x=57 y=283 width=70 height=70 time=0 layer=0 visible=true]
[else]
[endif]

Where the image for the item is shown if the variable is 1, and nothing otherwise.

[will finish the post later]
Last edited by Shimmersoft; Apr 5, 2020 @ 1:09pm
Ace Apr 6, 2020 @ 2:53pm 
Thanks for your response! Your RE4 Otome inventory looks exactly like the kind of thing I'm looking for. I'm still pretty ignorant about coding in general, but I'm starting now to mess around with the sleep/awake functions and the hide/unhide screen. I've managed to get the hide function to show my inventory screen, but it also seems to cover all the inventory button images I have. Next up I'll work on creating layers to represent them, because I'm assuming that's going to solve that issue, but I'll update my post when I inevitably fail. Thanks again!
Ace Apr 19, 2020 @ 4:36pm 
I'm struggling a lot with getting the hide/unhide and sleep/awake functions of the game to work. I have an image button that I use to jump to a label that is supposed to put the game into "sleep" and jumps to my inventory page, but the button isn't doing anything. I'm using the available plugins to do this, maybe I should be going straight to code instead? Regardless of whether I use the plugin or the code that you recommended, I'm not sure where to put it on the scene page considering the amount of jumping around that happens in every one.

I looked at this previous post:
https://steamcommunity.com/app/345370/discussions/1/2944710017716954005/
to try and figure out the sleep/awake game functions a bit more, but am failing drastically.
Shimmersoft Apr 19, 2020 @ 11:55pm 
Originally posted by Ace:
I'm struggling a lot with getting the hide/unhide and sleep/awake functions of the game to work. I have an image button that I use to jump to a label that is supposed to put the game into "sleep" and jumps to my inventory page, but the button isn't doing anything. I'm using the available plugins to do this, maybe I should be going straight to code instead? Regardless of whether I use the plugin or the code that you recommended, I'm not sure where to put it on the scene page considering the amount of jumping around that happens in every one.

I looked at this previous post:
https://steamcommunity.com/app/345370/discussions/1/2944710017716954005/
to try and figure out the sleep/awake game functions a bit more, but am failing drastically.

You're probably going to need code, 'cause you need to tie role=sleepgame to that button directly. E.g., [button name="inventory" role=sleepgame storage=scene.ks target=*label x= y= width= height= ...]

This button should be brought in early on in your scene and since it's a "fix" layer button, it will remain on screen until it's removed by [clearfix].

Once the button is set to jump, you should be able to use hide/unhide to sweep away elements and introduce new ones. Once we get to that point, I'll assist further. One step at a time!
Last edited by Shimmersoft; Apr 19, 2020 @ 11:56pm
Ace Apr 20, 2020 @ 12:17pm 
Thanks for the quick response! Using your code I was able to make a visible button that makes the jump properly:

[button name="inventory" graphic="log.png" role=sleepgame storage=inventory.ks target=*FIRST x=45 y=45 width=300 height=350]

I then used the hide function to put up my base inventory screen without any items on it, but can't make any images appear on top of it. I'm guessing that's an issue of needing the layopt layer and freeimage layers you mention in your first post. Are the freeimage layers meant to represent each item while the layopt layer initially hides them all before the variable is activated?
Shimmersoft Apr 20, 2020 @ 10:27pm 
Originally posted by Ace:
Thanks for the quick response! Using your code I was able to make a visible button that makes the jump properly:

[button name="inventory" graphic="log.png" role=sleepgame storage=inventory.ks target=*FIRST x=45 y=45 width=300 height=350]

I then used the hide function to put up my base inventory screen without any items on it, but can't make any images appear on top of it. I'm guessing that's an issue of needing the layopt layer and freeimage layers you mention in your first post. Are the freeimage layers meant to represent each item while the layopt layer initially hides them all before the variable is activated?

Think of the hide function like a theatrical curtain - it exists for you to set the scene away from the audience's eyes, but you have to eventually pull back the curtain. So you need to use Unhide Screen once you've placed your elements.

To clarify, all of those tags I listed as an example are for "clearance" - basically to eliminate any elements that might be on screen when sleepgame is activated. Remember with sleepgame that the game is "paused" so you can basically clear all graphics in preparation for a new scene. But once you get rid of everything, then you have to lay down the new material. That's where this gets a little trickier and you need to plan around a few questions:

1) Are items collected in a linear, predictable order or is it variable based on player choice?
2) Does each item need to have some "flavor" text when clicked on?
3) Do all items appear on a single page or do you want separate "pages" (which will involve some jumps)?

So in RE4, for instance, I made life a little easier on myself by just assigning single items to particular boxes, so that it wouldn't matter what order they were picked up in. As you've seen, I also concentrated them on a single page to minimize jumps and items can be clicked on for flavor text. But there are other ways to do this, so you'll want to sketch out how you want yours to look.

Regardless of how you proceed, you'll still need a couple of things:

1) A variable attached to each item, which will be used to signal that it's in your inventory
2) A variable attached to the choice being made within your inventory. So in RE4, I have a bunch of [if] statements like these that correspond to flavor text:

[elsif exp="f.inv_choice==2"]
[image name="item_big" storage=default/inventory/herb-green.jpg x=530 y=125 width=130 height=130 time=0 layer=0 visible=true]
[mtext text="Green Plant" x=660 y=175 face=lucky_typewriter color=0xfb5ce3 size=30 in_effect=pulse fadeout=false layer=1 time=500 wait=false]
Some kind of green plant. I have a suspicion that it's marijuana, but I don't know anything about drugs! Really!

Each box also has an invisible button over the top of it that's used to click on the item and bring up the flavor text. Each button evaluates a variable "inv_choice" to a certain number, so that it activates the proper [if] statement. That looks like this:

[if exp="f.inv_herbgreen==1"]
[button name="slot2" fix=true graphic=button/menu/info-d.png enterimg=button/menu/info-h.png clickimg=button/menu/info-c.png x=165 y=51 width=70 height=70 exp="f.inv_choice=2" target=*start enterse=misc/inventory_hover.ogg]
[else]
[endif]

The exp="f.inv_choice=2" part is the variable being set to 2, which triggers the flavor text. The "f.inv_herbgreen" is the item's variable, and the [if] statement basically says "if this item has been set to 1 i.e., picked up, then show this button; otherwise, show nothing".

That's more than you probably need to know at this stage; I just want to give you some forewarning about future steps. For now, what you want to do is:

1) Sketch out your desired layout
2) Tinker with just placing graphics
3) Create variables for each inventory item and a variable for "inventory choice"

Once you get those done, you might share your desired layout and I can advise further. Let me know if you have any questions!

< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Apr 5, 2020 @ 9:43am
Posts: 6