If you are requesting technical assistance with Twine, please specify:
Twine Version:2.5.1
Story Format: sugarcube 2.36.1
Hello,
I’m currently building a game where i want to provide several Avatar Pictures that will change by progressing through the story. Ideally in the sidebar.
An example would be when you make a decision, you receive a specific Item or a point or even lose one. By altering this score by 1 the Image should change to a specific one.
So far i tried a few ways but i couldn’t get a working solution.
Maybe someone could help me out.
Hi there!
If you are using the Built-In Sidebar, you can use the UI-BAR Special Passages to include that avatar picture. Depending where you want to place it, I would suggest StoryBanner or StoryCaption.
For the code itself, I would use conditional statement (the <<if>>
macro) to have the picture change depending on where you are in the story or if a certain variable reach a certain value.
For example:
<<if $var is 3>><img src="image.png"><<elseif $var is 2>><img src="image2.png"><<else>><img src="image3.png"><</if>>
1 Like
First of all thank you.
I tried it out.
Thats my “StoryCaption” window so far.
<<set $stone to 0>>
<<if $stone is 0>> *picture 0.jpg
<<elseif $stone is 1>> *picture 1.jpg
<<elseif $stone is 2>> *picture 2.jpg
<</**if>>
My problem is that i can’t change the set variable no matter what i try.
So far everything is working except the counter.
Can you edit your code with the Preformatted Text markup (</> in the text editor) wrapped around it? I think it gooped some of the code…
Also $stone should be set in StoryInit otherwise everytime you change passage StoryCaption will reset the variable.
1 Like
I hope it’s readable now. The is StoryInit is also filled with
<<set $stone to 0>>
Currently i’m trying to increase the counter by entering a specific passage and use <<set $stone += 1>> at the top of the passage.
That should work then
If the variable changes after the whole passage is rendered (through a choice or just because), you can use this custom macro to update it.
1 Like
Never mind, i did it. I found a little extra command that forced a reset every time…
But it works now, thank you a lot for your time and input!
1 Like