Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Fleece

A dialogue manager for Unity that doesn't fray at the edges. · By KaiClavier

Adding player inputed name?

A topic by theshepherdshound created Nov 03, 2019 Views: 232 Replies: 5
Viewing posts 1 to 2

Is there a way I can let players add their own name into a variable I can call?

Developer

Yeah!

Check out the parser and drawstring classes… these can be overridden to insert variables from other parts of your project, like a stored player name!

The default parser in Unity is actually set up to do this a bit. You can reference the FleeceDefaultParser scriptableObject in your code, and when the player puts a name into the game, save it there as a variable named “playerName”. Then, to insert it into any fleece string, the tag <<$playerName>> will reference back to this!

You can store these variables in a different place by writing your own Parser or custom Drawstring commands! (For instance, <<GetName()>> could be programmed to return a player name from some object in the game)

I hope that helps you get started, let me know if you need any further help!

Is there a way to make and statements? Something like <<if $check1 && $check2 == true>> ?

Developer

I was considering this feature, but I won’t be able to add it for a while… so here’s the current solution!

In your parser, you could make it so if $check1And2 is passed as a variable name, it returns check1 && check2! It’s a bit roundabout and more hard-coded than I’d like, but at the moment, that is what it is.

Hmm, okay, I will work around that.

More hyper specific questions! I am trying to make variable controlled options appear, or even just to continue down a train of dialogue when certain variables are fulfilled, but unless I have an option that have no requirement, it default continuing the narrative to the first link, regardless of if the variable has been completed.

What is the best way to have dialogue move down a certain path if certain requirements have been met?

Developer

Look at “empty passage logic” in the documentation, and I think that’s what you want!

When using a Drawstring, by default, if a passage has no text stored in it, it will follow the first link that has text that evaluates to “True”. So… if a link’s text is <<$myVariable == 0.5>> or something… that tag would be replaced with “True” or “False”. If all links are false, the final link is followed!