Using Conversant and Actor to get fields from actors.
Posted: Wed Dec 20, 2017 12:26 pm
I have a generic conversation template which I'm planning to use for most of my NPCs.
It handles some things that are general for almost every NPC. For example there are some default entries with conditions that check whether the Player has already talk to NPC or not, what is NPC's attitude towards the Player etc.
For Dialogue Text I use stuff like [lua( Actor[Variable['Conversant']].Name)], for conditions I use Actor[Variable["Conversant"]].HasBeenIntroduced == false etc
Using Conversant and Player instead of actors' names allows me to copy this generic conversation and simply change conversant without touching conditions / scripts.
I tried this approach and it worked - I made a game object "Witch" with Conversation Trigger, I dragged Player's and Witch's transforms on the Trigger (Player and Conversant fields) and everything works.
Now I tried to display her name as "Wendy the Witch", and I couldn't.
First, I tried to use "Display Name". I set it to "Wendy The Witch" and get this error.
Dialogue System: Lua code 'return (Actor[Variable["Conversant"]].HasBeenIntroduced == true) and (Actor["NPC"].NewVisit == false)' threw exception 'Lookup of field 'HasBeenIntroduced' in the table element failed because the table element itself isn't in the table.'
I renamed the game object to "Wendy The Witch", but it didn't help.
Ok, I disabled "Use Display Name" and renamed the actor to "Wendy The Witch" and also renamed the game object to "Wendy The Witch". And it also doesn't work.
Then I renamed the actor to "Wendy_The_Witch" and it worked just fine. Of course, I can't use this name in the game.
So, I can't see a way to use the generic stuff like Actor[Variable["Conversant"]] and to use the Display Name or the name with spaces at the same time.
Maybe I am missing something?
Also, is there any way to group actors? Something like Castle/King, Castle/Guard, Lair/Dragon, Lair/Guard etc (like with conversations). I tried to use it this way and it almost worked: https://ibb.co/gxRWqR
So, it would be nice to group actors via their names and to use Display Name as their actual name.
It handles some things that are general for almost every NPC. For example there are some default entries with conditions that check whether the Player has already talk to NPC or not, what is NPC's attitude towards the Player etc.
For Dialogue Text I use stuff like [lua( Actor[Variable['Conversant']].Name)], for conditions I use Actor[Variable["Conversant"]].HasBeenIntroduced == false etc
Using Conversant and Player instead of actors' names allows me to copy this generic conversation and simply change conversant without touching conditions / scripts.
I tried this approach and it worked - I made a game object "Witch" with Conversation Trigger, I dragged Player's and Witch's transforms on the Trigger (Player and Conversant fields) and everything works.
Now I tried to display her name as "Wendy the Witch", and I couldn't.
First, I tried to use "Display Name". I set it to "Wendy The Witch" and get this error.
Dialogue System: Lua code 'return (Actor[Variable["Conversant"]].HasBeenIntroduced == true) and (Actor["NPC"].NewVisit == false)' threw exception 'Lookup of field 'HasBeenIntroduced' in the table element failed because the table element itself isn't in the table.'
I renamed the game object to "Wendy The Witch", but it didn't help.
Ok, I disabled "Use Display Name" and renamed the actor to "Wendy The Witch" and also renamed the game object to "Wendy The Witch". And it also doesn't work.
Then I renamed the actor to "Wendy_The_Witch" and it worked just fine. Of course, I can't use this name in the game.
So, I can't see a way to use the generic stuff like Actor[Variable["Conversant"]] and to use the Display Name or the name with spaces at the same time.
Maybe I am missing something?
Also, is there any way to group actors? Something like Castle/King, Castle/Guard, Lair/Dragon, Lair/Guard etc (like with conversations). I tried to use it this way and it almost worked: https://ibb.co/gxRWqR
So, it would be nice to group actors via their names and to use Display Name as their actual name.