So I'm making a simple game in which you talk to characters and "give them objects", which are not 3D objects or game objects, just imaginary, spoken about in the dialogue. However, if you don't talk to people in the right order, you can't progress in the game, because you have to find the person who has an item that someone else will want. Does this make sense?
I'm just trying to program the dialogue so that, once a character has talked to the correct person, they will "gain an item" and when they talk to the next person, they will have a new choice in the dialogue, which allows them to "give the item." Is this possible with any dialogue generators, and how can I do this?
If I understand your question correctly than you simply have to set a boolean variable true when the plyaer starts the dialogue and when they start the next one you check for that variable and initiate the dialogue based on whether it's true or false.
You could add a collider component to the player controller and set it to be a trigger. Than you could add a script like this to the player controller gameobject.
I'm not sure if this is what you were asking for. I would make the dialogue itself with GUI scripting. Here are some links that might help:
So I'm making a simple game in which you talk to characters and "give them objects", which are not 3D objects or game objects, just imaginary, spoken about in the dialogue.
Ok, I guess you can get away with text. "A comb." or "A pair of scissors."
However, if you don't talk to people in the right order, you can't progress in the game, because you have to find the person who has an item that someone else will want. Does this make sense?
Yes. John needs a comb and will give you a pair of scissors for the exchange. Sarah need scissors for you to complete the game.
I'm just trying to program the dialogue so that, once a character has talked to the correct person, they will "gain an item" and when they talk to the next person, they will have a new choice in the dialogue, which allows them to "give the item."
Okay you need to keep a game state. Basically each person has a request and give something in return. The player can carry one or several of these objects (texts). Its easily set up with an enumeration.
public enum Items
{
Comb,
Scissors,
EndOfGame
}
public class Person
{
public Player player;
public Items request;
public Items reward;
public string requestDialogue;
public string rewardDialogue;
bool isDialogueOpen = false;
bool isRewardGiven = false;
void OnGUI()
{
if (isDialogueOpen == false)
return;
if (isRewardGiven)
{
// display gui like "oh thanks so much" using rewardDialogue
}
else
{
// display gui like "i need this and that" using requestDialogue
if (player.Has(request))
{
if (GUILayout.Button("Give blah to person"))
{
player.Give(reward);
isRewardGiven = true;
}
}
}
}
}
public class Player
{
private List<Items> items = new List<Items>();
public bool Has(Items item)
{
return items.Contains(item);
}
public void Give(Items item)
{
items.Add(item);
if (item == Items.EndOfGame)
{
// game completed
}
}
}
Is this possible with any dialogue generators, and how can I do this?
Your help would be much appreciated!!!
I don't know of any "dialogue generators" but you can do this pretty easily yourself.