Change name of character depending on index

Hi there! I’m a beginner game developer and I’m trying to change the name of the person speaking depending on the index, so for example on Index [2] I’d want the text to say “you” instead of “dad” but I don’t know how to do that specifically.
Any help would be great! images would help a ton :slight_smile:

Images

Hello @GooseT03s ,

if you want to do that, you can just do a branch check for example

however, in my opinion, this is a bad way to do that since this will be problematic if there are many character OR you have tons amount of dialogues to play. and if you use this attemp, you will confuse yourself and make your testing harder later. There are many ways to do this kind of thing.

If I’m working on something like this, what I do is instead of saving only the dialogue, also save the person name who is talking by creating a struct (Right click in content browser > Blueprint > Structure).

After then, just store that struct in the array (TArray). That way, you don’t need to confuse about who is talking this text because you already assign it per dialogue and just easily bind it later.

I think this will be easier for your development process later instead of what you doing now.

You can also change the Name from FString to Enum if you want, you can create enum by right click at content browser > Blueprint > Enumeration.


then change the struct

Result:


by using an enum, you can just fill the name and pick from a dropdown. That way, you don’t need to always type the name and just pick it (at least it can save you from writing long name tons of time). But the binding will be different than the first one I show you. It will have more step, but I prefer this way.