Unity Ver: 2019.2.4f1
AC Ver: 1.71.3
Hello!
Is there a way to have a conversation option be random? In the sense of each time the conversation is displayed, the last choice would be random?
P
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
In what way? The same option with different label, or chosen at random from a selection of separate options? And only the last option?
It's possible to modify which dialogue options are enabled through script, so you could randomly choose an option from a given set of indices. Probably best to do this when the OnStartConversation event is called:
Hey Chris,
Yeah, so my desire is to have this conversation option change every time the conversation is displayed. It would be a pool of options and each time it chooses one.
Is there any facility to do this within Action Lists or is it definitely a code job?
Thanks!
So, the label only. Not the result of clicking it?
It's a code job if randomness is involved, but you can change the label of an option easily enough:
If you want it to literally be a random option (i.e. both label and result different), you'll need to define all available options in the Conversation itself and use/adapt the code earlier.
@ChrisIceBox Thanks so much! I've got this working with the code snippet above and attaching it to the conversation gameobject. Took me a while just to understand the flow and logic of it but got there!
Also this way of setting a bool is brilliant;
option.isOn = (option.ID == chosenID);
Just isn't a structure I've ever used. Love it.