Hi,
Thanks for buying the Dialogue System!
mellopillow wrote:Whenever I go interact with the NPC using the proximity selector script or any other selector script, the camera angle zooms out and stays in that angle even when the conversation has ended. Is there any way to fix this, or better yet, have it not use a camera angle altogether?
Set the Dialogue Manager's Display Settings > Camera Settings > Default Sequence to:
Delay({{end}})
This will pause the subtitle for a duration proportional to the text length, without touching the camera.
If you end up using
Camera() sequencer commands to control the camera during conversations at some point, you'll want to temporarily disable your smooth camera follow during the conversation to prevent it from fighting with the Dialogue System. Use the
Set Component Enabled On Dialogue Event component to do this. You can read more about this in the
How To Set Up The Player section. You can also use this component to temporarily prevent the player from moving around during conversations.
mellopillow wrote:Another thing I would like to know is how can one trigger an event when a player chooses an option from a dialogue, specifically setting a float variable from a different script to a different number.
Register a C# method with the Lua environment, and then use it in a dialogue entry node's Script field.
For example, say you have a script that keeps track of a value such as GPA:
Code: Select all
public class GradePointAverage : MonoBehaviour {
public float gpa; //<--This is the player's current GPA.
}
Add a method to change gpa, and a couple methods to register it with the Dialogue System:
Code: Select all
using PixelCrushers.DialogueSystem;
public class GradePointAverage : MonoBehaviour {
public float gpa; //<--This is the player's current GPA.
void OnEnable() {
Lua.RegisterFunction("SetGPA", this, typeof(GradePointAverage).GetMethod("SetGPA"));
}
void OnDisable() {
Lua.UnregisterFunction("SetGPA");
}
public void SetGPA(double value) { // Lua uses doubles.
return gpa = (float) value;
}
}
Then use the "SetGPA" function in a dialogue entry node:
- Dialogue Text: "Great job! You get an A+."
- Script: SetGPA(4.0)
If you register Lua functions that return values, you can also use them in the Conditions field. For example, say you've registered a function GetGPA() that returns the current value of gpa:
- Dialogue Text: "Would you like to join the Honors Program?"
- Script: GetGPA() >= 3.5