Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Hey! I'm feeling a bit dumb for getting troubles and not finding the answer out there, but this is just for a silly dating sim for a few characters in a d&d game I'm on, so who cares if I look silly asking this, hahah.

Anyhow, could you tell me how I make a choice change a variable? I was trying to add a few choices that change the mc's personality at the start of the game. One of the choices is
*[["I am not crying." You say, even tempered. You want to, though!|2]], which I would want to make the variable $stoic true.
I tried writing <<set $stoic to true>> before the brackets, but then once I added choices that set other personalities to true in the same way, they all ended up true at the same time.

I tried writing
*[[<<set $stoic to true>>"I am not crying." You say, even tempered. You want to, though!|2]]
but that makes the code show up in the choice.

Could you help me on how to make choices change variables? Thank you!
(I don't know if it matters, but in the story int, I put all personality variables as <<set $stoic to false>>, <<set $polite to false>> and so on)

(1 edit) (+5)

Hi, I'm not the creator but I hope you don't mind me answering because I remember this tripped me up early in development too, but it's surprisingly simple! Using your example, the format you'd need is this:

[["I am not crying," you say, even tempered. You want to, though!|2][$stoic = true]]

Whatever you put in that second set of brackets inside the choice will only execute when someone selects it. You can also have multiple variables in those brackets, just separate them with a comma. For instance if you wanted to like, let someone change their hair mid-game you could have something like

[["It's perfect!"|2][$hair = "straight", $hairlength = "short", $haircolor = "blue"]]

(+1)

Aaah, thank you so much! That helps out a lot!!! And being able to put diffent variables is so cool, too! I wouldn't have thought of that, or at least, would have done it wrong. :P

(also, I had accidentally clicked report instead of reply and got so worried for a second, haha)

Yeah no problem 👍 I honestly don't remember where I had to go digging for that info so I'm happy to pass it along. Happy coding!

Definitely not a dumb or silly question! I'm sorry it took me forever to respond, but Charlie's answer is perfect! Something that helped me a lot when I started learning how to code in twine was this post (which is all about setting stats): https://idrellegames.tumblr.com/post/665163387870822400/hi-so-im-learning-twinesugarcube-and-ive-been

Hope that helps and let me know if you still have any trouble!

No worries! It definitely helps a lot, specially since this is really just a fun little game for me and my friends and I don't want to stress over it, haha.

Really, thank you so much! I read the post and it was so informative, you answered a question before I even had it, haha. (I'm sure I would have been confused eventually about how to set a max and min value for a stat)