Adding Actors to db at runtime?
Posted: Sat Jul 02, 2022 9:45 am
I've a list of generated NPCs at runtime I'd like to add as actors, permanently changing the asset db. However, I can't see what I'm missing to make this work. I have the Dialogue system Controller setting for 'instantiate database' unchecked. Do I perhaps needs to create a new db, merge, and then somehow write it to the asset?
I've also tried to just alter the existing actor's name, but that doesn't seem to stick either.
Code: Select all
Actor a = new Actor()
{
Name = c.GetCitizenName(),
IsPlayer = false,
Description = "A citizen who enjoys " + c.GetCitizenPreference().ToString()
};
DialogueManager.databaseManager.MasterDatabase.actors.Add(a);
Code: Select all
DialogueLua.SetActorField("NPC Actor", "Name", c.GetCitizenName());