daterre / Cradle

Play Twine stories in Unity.
MIT License
298 stars 32 forks source link

Using Twine Text Player for dialogues #75

Closed lbaptista95 closed 5 years ago

lbaptista95 commented 5 years ago

Hi, I was searching for a way to make dialogues with multiple answers options in my game and then found this. Then I created a script that's called Dialogue Trigger, which is a component attached to the player. This script verifies if the other character has a Cradle Story attached to him, if it returns true, it shows "Press E to talk to [Character Name]". After I press E, the script instantiates a TwineTextPlayer prefab with the dialogue I made for that character and at the end of some passage it destroys the TwineTextPlayer instance. The little problem I'm having with this is that I always have to press E twice to start the dialogue. The first time I press the key, the TwineTextPlayer prefab is instantiated but doesn't start the conversation, so I have to press E a second time.

Do you know if there's some configuration that allows me to instantiate the prefab and start the dialogue (story) at the same frame?

daterre commented 5 years ago

Sorry it took me a while to get back to you. I'm not sure what exactly your E button is doing but you can call Story.Begin yourself via script - it should then work immediately.