Hello everyone
I'm new to both Unity and AC, trying to create an educational game.
What will be the best way to go about this:
Some words appear on the screen and need to be reordered so as to make a sentence.
Example : Australian I am .
How I am currently doing it is , I created multiple (in this sentence -three) conversations. If the correct word is selected, the next conversation starts, else the skip option is chosen, that is the same conversation restarts. The sentence starts to form , in the first dialog of the next conversation, everytime the correct word is chosen it gets added (manually) to the first dialog of the next conversation and it is removed from the dialog options.
Conversation1
Australian
I
am
Conversation2
I
Australian
am
Conversation3
I am
Australian
Play dialogue : I am Australian
Is this a good way to do this or is there a better way?
image of how i am doing it currently
Thanks
Comments
Presumably this would be just one of many such sequences in your game, so you'd want the Actions involved to be as simple as possible, and ideally rely on just one Conversation.
If it's necessary to have the first line of the next Conversation show the "already chosen" words, you'd probably be best off by just re-writing the conversation labels as you go. This can be done with the Dialogue: Rename option Action. You can also hide options from view with Dialogue: Toggle option.
I'd say generally this kind of thing would be made much easier by incorporating some simple scripting. Building sentences like this isn't totally aligned with what Conversations are intended for, so trying to achieve this with AC on its own could well be more trouble than its worth.
If the intention is for the "sentence" to be added upon with each label the user picks, you should consider storing the sentence in a String Global Variable, which you can then display in a character's speech using the [var:X] token (see the "Custom tokens" chapter in the Manual). Adding a Conversation's label to a string doesn't take much code:
using UnityEngine;
using System.Collections;
public class AddLabelToVar : MonoBehaviour
{
AC.Conversation myConversation;
int stringVariableID;
public void AddLabelToStringVariable (int dialogOptionIndex)
{
string chosenLabel = myConversation.options[dialogOptionIndex].label;
string stringValue = AC.GlobalVariables.GetStringValue (stringVariableID);
AC.GlobalVariables.SetStringValue (stringVariableID, stringValue + " " + chosenLabel);
}
}
You can add that to a GameObject in your scene, and use the Object: Send message Action to call it's "AddLabelToStringVariable" function, passing the chosen option index value as a parameter.
For more on using scripting to work with AC, see the Scripting Guide.
ActionList parameters allow you to "recycle" Actions by changing their fields at runtime (a tutorial can be found here), however I would recommend first simplifying your first sentence before tackling this.
2. This is similar in behaviour to a "keycoded lock safe" then. A number of threads on this can be found by searching the forum, but essentially it works by increasing a "score" variable each time the user presses the right option and the right time. A couple of examples:
https://www.adventurecreator.org/forum/discussion/5145/puzzle-type
https://www.adventurecreator.org/forum/discussion/550/need-help-with-coded-lock
You should be able to use this in conjunction with the same Conversation object to create such a sequence. I'd recommend getting the win/lose logic set up first before tackling the actual display labels.
3. A sentence can be displayed on screen forever with the [hold] token (see "Text tokens" in the Manual). This doesn't survive scene changes, however. For that, you would have to manually re-show it via your scene's OnStart cutscene.
4. Disappears when after displaying? Is it showing correctly in your Variables Manager at runtime? I think it'll be necessary to see related screenshots here.