# Node Properties And What They Do For You
The Dialog, Choice, Start, and End Node types have an additional (and optional) section for adding custom properties to them.
So what are Node Properties and how do they help you craft remarkable narrative?
Let's say you want to add VO to your game...
Or let's say you want specific dialogue boxes to have a unique look...
Or maybe while conversations with characters have one UI style, you want a completely different UI when the player interacts with a computer or other object...
Or perhaps you'd like to display a different font for specific moments in your narrative...
Or maybe you want to associate a specific image, animation, sprite, model, camera angle, scene change, special effect, etc. to a specific narrative-content Node (hence the reason Properties are only available for Dialog, Choice, Start, and End Nodes).
Basically, if you want or need to associate any piece of data to any narrative-content Node (Dialog, Choice, Start, End), Properties are perfect for this.
## How To Add Properties
To add a Property to any narrative-content Node, simply open that Node in the Node Editor, scroll down to the bottom, and click the "Add Property" button.
![[Node Properties.webp]]
Each Property has two fields: Name and Value.
> [!tip]
> If Properties seem confusing to you, don't worry!
>
> This is a powerful albeit advanced feature of NarrativeFlow, so no one will fault you for some confusion.
>
> In addition, there are plenty of wildly successful video game narratives that don't need Properties, so don't feel bad if your narrative doesn't need them either.
>
> And if you narrative doesn't need Properties, you can safely skip this guide.
### Name
This is the identifier of the Property, so you can tell your game engine what to do with data with that identifier.
For example, if your game has VO and you need to define the VO file associated with each Dialog Node, you could simply use the Property name "VO-File", with the file's name or path being entered in the Value field.
Then, you can tell your game engine to look for a Property with the name "VO-File" whenever you retrieve a Dialog Node and load the audio file entered in the Value field.
Or let's say you want to display specific images/animations/sprites for each Dialog Node in your narrative which display different emotions of the characters talking (think Persona, Stardew Valley, etc.).
Similar to the above example, you could define a Property called "Emotion" and enter the emotion you want the talking character to have for that Dialog Node, such as "Happy", "Surprised", "Shocked", etc.
Then, you can tell your game engine to change the talking-character's image/animation accordingly.
### Value
While the Name field is the identifier for a Property so the game engine knows what you want the Property to change or influence, the Value is what you want it to change to.
For example, let's say you've defined the following Property: `Name: Emotion`, `Value: Happy`.
- "Emotion" (the name/identifier of what you're changing) tells your game engine that you're changing the talking-character's image/animation/sprite.
- "Happy" (the value associated with the name/identifier) signals to your game engine what you're changing the talking-character's image/animation/sprite to.
One thing to be aware of is that like every other field in NarrativeFlow the Value field of Properties is text-only.
So how do you associate any information besides text, like a file, an image, etc.?
If you need any non-text-based information in a property, simply add a reference to the file's name or path, a code function call, a code script, an internal engine string or reference, etc.
For example,
`Name: VO-File`, `Value: Shop-Owner-Greeting.wav`,
`Name: Icon`, `Value: Awesome-Icon.png`,
`Name: Background Image, Value: Kitchen`, etc.
When your game engine gets the data for a Node with Properties, the engine can then know where to find and read the data you've associated with that Node.
> [!NOTE]
> Remember that, like many features of NarrativeFlow, Properties are completely optional. If they seem a little complex for your needs, that's totally fine!
>
> Many great indie games out there only use text (sometimes with a little bit of text-styling) for their entire narrative, and that's it!
>
> Don't feel like you have to use a feature unless you have a need for it.
## Advanced Uses Of Node Properties
We've just talked about the usual, more common uses of Properties.
Here, I'd like to show you examples of some less obvious or more advanced uses with the intent to inspire and help you design your powerful narrative.
### Properties For Individual Choices
Let's say that you want to associate different Properties for each choice, not just the Choice Node as a whole.
For example, let's say you wanted a different icon associated with each choice that indicates which emotion or demeanor that choice is "said" with.
While this could be accomplished with text styles or a keyword in each choice's field (which is probably the best method), there are a few alternate ways you could accomplish this in NarrativeFlow, so let's check them out.
The first way is to have a Property named something like `Choice Icons` with a value of comma-separated icon names, like this: `Bold, Cool-headed, Chill`.
Then, in your game engine, you could parse this value and display icons next to your choices based on their order.
Another approach would be to have a different Property for each choice, like this:
`Name: Choice 1 Icon, Value: Bold`
`Name: Choice 2 Icon, Value: Cool-headed`
`etc.`
These examples could also easily be adapted to define a different font or color for each choice, a different way to present it to the player, etc.
> [!NOTE]
> I've considered adding a feature to NarrativeFlow that allows you to attach Properties directly to individual choices rather than these workarounds (i.e. a separate Properties list/section for each choice).
>
> Is this a feature you'd like to see implemented? If so, please [reach out to me here](https://narrativeflow.dev/lets-talk) and let me know!
### Tracking Choices
Do you know how some games with dialogue options will gray-out a choice if you've previously chosen that option?
Like when you talk with a character, a topic that you've already chosen to talk with them about is grayed-out.
This functionality is a bit more advanced, yet is very much possible in NarrativeFlow.
One way (though more advanced) is to modify the NarrativeFlow [interpreter script](Using%20NarrativeFlow%20With%20Your%20Game%20Engine.md#The%20NarrativeFlow%20Interpreter%20Script) to allow your game engine to modify Properties in real-time and toggle a flag when a choice is selected.
While entirely valid, there might be a simpler way.
Using a similar method to the icon example above, you could create either a Property unique to each choice or a comma separated one, with a unique id associated with each choice.
Something like this:
`Name: Choice Ids, Value: A_001, A_002, etc.`
Or
`Name: Choice 1 Id, Value: A_001`
`Name: Choice 2 Id, Value: A_002`
`etc.`
Then, in your game engine, when the player selects a choice, add the unique id associated with it to a `std::unordered_set`/`Set`/`HashSet<T>`.
When a Choice Node is encountered in your game engine, simply check if the associated unique id is already in the set.
If it is, you know it has previously been selected by the player and you can display it as grayed-out, unavailable, etc.
### Modifying Available Choices At Runtime
In some RPGs, the game will present the player with different choices depending on various factors about your character, such as their origin/background, their class, a skill's level, a proficiency in a certain stat, etc.
In the cases where you only need 2-3 variations, creating multiple Choice Nodes for each variation is a perfectly acceptable way to accomplish this.
There's an easier and less cluttered way though.
And in the cases where you might have dozens of possible variations, with the available choices being dynamic, creating a different Choice Node for each variation is extremely inefficient and very difficult to manage.
Thankfully, one way we can solve this is with Properties.
Let's say that you have a Choice Node with three choices, and you want the third to only be available if a specific variable is true.
You could easily accomplish this by configuring a Property something like this:
`Name: Is Choice 3 Available, Value: [HasPlayerBeenToMars]`
If you want to check for multiple variables, you could use a comma-separated method like this:
`Name: Is Choice 3 Available, Value: [HasBeenToMars], [HasMetCharacter], [IsCloseFriendsWithCharacter], etc.`
At runtime, when your game engine encounters this Choice Node, the variables in the Properties will be replaced with their current value, in this case either `true/yes` or `false/no`.
NarrativeFlow doesn't limit you to any one solution.
You get to use any method that is the most intuitive to you, whether the methods talked about here or your own creative solutions.
For example, if you wanted to take these examples further and have your game engine parse the value of a Property as a comparison statement, you could very much do that:
`Name: Is Choice 3 Available, Value: [PlayersReputation] > 30`.