Hello, I was curious if anyone could help me. I wanted to know how to block the player from going to any scene if they have to do something first. Like talking to an NPC.
For example, if the player tries to go to that area a conversation will show up saying "I should talk to X first". I have all of the scene portals set up for my game so far so now it's just about setting restrictions.
How to block player's path?
Re: How to block player's path?
Hi,
You could use a subclass of ScenePortal like this:
ConditionalScenePortal.cs
It adds a Condition section and a Conditions Umnet Conversation.
Then set the Condition section. For example, use the Lua Conditions subsection to check if a variable is true:
In the conversation with NPC X, set the variable true.
If the variable is true when the player enters the Scene Portal, it will go to the next scene. Otherwise it will play the Conditions Unmet Conversation.
You could use a subclass of ScenePortal like this:
ConditionalScenePortal.cs
Code: Select all
using PixelCrushers;
using PixelCrushers.DialogueSystem;
public class ConditionalScenePortal : ScenePortal
{
public Condition condition;
[ConversationPopup(true)] public string conditionsUnmetConversation;
public override void UsePortal()
{
if (condition.IsTrue(null))
{
base.UsePortal();
}
else
{
DialogueManager.StartConversation(conditionsUnmetConversation);
}
}
}
Then set the Condition section. For example, use the Lua Conditions subsection to check if a variable is true:
Code: Select all
Variable["Talked_To_NPC_X"] == true
If the variable is true when the player enters the Scene Portal, it will go to the next scene. Otherwise it will play the Conditions Unmet Conversation.
Re: How to block player's path?
Awesome it works perfectly! Thank you so much for the help!
Re: How to block player's path?
Glad to help!