Search Unity

[Gameplay data structure] Dialogue and Choices

Discussion in 'Scripting' started by Micio_del_Cheshire, Apr 11, 2017.

  1. Micio_del_Cheshire

    Micio_del_Cheshire

    Joined:
    Oct 24, 2013
    Posts:
    28
    Hello there!
    I'm testing for the first time around dialogue trees.

    I'm storing the conversations inside an XML file. Simple Conversation nodes: prompt with id, answers and links to other nodes.

    It works great.
    But what's the smartest way to make some answer "active"? What if I want consequences? I obviously can't hard-code the possibilities in the conversation manager, so I have to encode it somehow directly in the xml.

    And not only story persistent choices. I'm talking also about animations. What's the best way to mark certain animation reactions based on the answer choosen?

    Thanks for the answers
     
  2. Boz0r

    Boz0r

    Joined:
    Feb 27, 2014
    Posts:
    419
    Can't you just add some extra tags with references to animations and C# functions? <whateverclass prerequisite=hasNoPantsOn animation = flailLikeARetard/>
     
    Micio_del_Cheshire likes this.
  3. Micio_del_Cheshire

    Micio_del_Cheshire

    Joined:
    Oct 24, 2013
    Posts:
    28
    yup...Solved.
    I didn't know the System.Reflection library and the method.Invoke function.
    Thanks for the tip ^^
     
  4. Boz0r

    Boz0r

    Joined:
    Feb 27, 2014
    Posts:
    419
    Reflection is awesome, but watch out, it can end up having a big performance cost if you do it too much. Save your function reference in a pointer or whatever.