How to set all dialouge values to true
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
How to set all dialouge values to true
Hey!
I want to create a time trial mode for my game and this requires that there's no dialogue that happens.
I thought one solution could be:
When the user chooses time trial mood, ALL the dialogue conversations turn true.
Or is there another way to completely remove the dialogue conversations when in a mode like this
I want to create a time trial mode for my game and this requires that there's no dialogue that happens.
I thought one solution could be:
When the user chooses time trial mood, ALL the dialogue conversations turn true.
Or is there another way to completely remove the dialogue conversations when in a mode like this
Re: How to set all dialouge values to true
Hi,
There are a few ways you can do this.
The heavy-handed way is to kill any conversation that starts. Add a script to the Dialogue Manager that has an OnConversationStart method. In this method, stop the conversation. Example (assuming you have a function IsDemoMode):
Or you could assign a method to DialogueManager.IsDialogueEntryValid, which is a delegate that you can set to do extra checks:
Or you could make a subclass of DialogueSystemTrigger and use it instead of DialogueSystemTrigger. Override DoConversationAction():
If you want to set all Boolean variables true, you could do this:
There are a few ways you can do this.
The heavy-handed way is to kill any conversation that starts. Add a script to the Dialogue Manager that has an OnConversationStart method. In this method, stop the conversation. Example (assuming you have a function IsDemoMode):
Code: Select all
public class StopAllConversations : MonoBehaviour
{
void OnConversationStart(Transform actor)
{
if (IsDemoMode())
{
DialogueManager.StopConversation();
}
}
}
Code: Select all
DialogueManager.IsDialogueEntryValid = CheckIfDemo;
bool CheckIfDemo(DialogueEntry entry)
{
return !IsDemoMode();
}
Code: Select all
public class CustomDialogueSystemTrigger : DialogueSystemTrigger
{
protected override void DoConversationAction(Transform actor)
{
if (!IsDemoMode())
{
base.DoConversationAction(actor);
}
}
}
Code: Select all
foreach (Variable variable in DialogueManager.masterDatabase.variables)
{
if (variable.Type == FieldType.Boolean)
{
DialogueLua.SetVariable(variable.Name, true);
}
}
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: How to set all dialouge values to true
The last solution you mentioned is definitely what I want. Because all the dialogue is originally false.
So I can just add this to my script and all of them will revert true. I'll try this right now
So I can just add this to my script and all of them will revert true. I'll try this right now
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: How to set all dialouge values to true
Also quick question. Is there a way to import the unity package Pixelcrush in code without seeing red squiggles under it?
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: How to set all dialouge values to true
This caused an error
I'm trying to uninstall these imports, but can't seem to find them because I didn't take a look at where they were going to be imported-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: How to set all dialouge values to true
*UPDATE*
I deleted the packages that were causing the issue luckily and it doesn't seem like anything was affected.
Updated VS package in Unity and so far, no squiggles. I'm still having a bit of trouble figuring out how I can implement the ability to remove all triggers and dialogue.
The foreach loop worked great, but there are some instances where I added a trigger collision to a gameobject for something to happen.
I'm not sure how I can just turn off the dialogue component that's on that trigger when I'm in this new trial mode
I deleted the packages that were causing the issue luckily and it doesn't seem like anything was affected.
Updated VS package in Unity and so far, no squiggles. I'm still having a bit of trouble figuring out how I can implement the ability to remove all triggers and dialogue.
The foreach loop worked great, but there are some instances where I added a trigger collision to a gameobject for something to happen.
I'm not sure how I can just turn off the dialogue component that's on that trigger when I'm in this new trial mode
Re: How to set all dialouge values to true
What about using one of the other techniques I suggested above?
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: How to set all dialouge values to true
Doing this approoach
Gives me red squiggles(Which also means the red squiggles in pixelcrush importing is back).
I would like to do this since it seems like it'd work, but am unsure why it's not importing right
Code: Select all
DialogueManager.IsDialogueEntryValid = CheckIfDemo;
bool CheckIfDemo(DialogueEntry entry)
{
return !IsDemoMode();
}
I would like to do this since it seems like it'd work, but am unsure why it's not importing right
Re: How to set all dialouge values to true
Where are the squiggles? If it's under IsDemoMenu, that's because you need to provide that function.