I've been trying to add a custom sequencer that calls a function that i've written inside another script, but the sequencer can't find most of the scripts i have written, heres the error I get :
Assets\Plugins\Pixel Crushers\Dialogue System\Templates\Scripts\SequencerCommandAudreyMove.cs(20,69): error CS0246: The type or namespace name 'DirectressMovement' could not be found (are you missing a using directive or an assembly reference?)
How can I reference this script inside the Sequencer? Heres how I set the custom SequencerCommand
using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandAudreyMove : SequencerCommand
{ // Rename to SequencerCommand<YourCommand>
public void Awake()
{
// Add your initialization code here. You can use the GetParameter***() and GetSubject()
// functions to get information from the command's parameters. You can also use the
// Sequencer property to access the SequencerCamera, CameraAngle, Speaker, Listener,
// SubtitleEndTime, and other properties on the sequencer. If IsAudioMuted() is true,
// the player has muted audio.
GameObject directressObj = GameObject.Find("Directress");
DirectressMovement dirMove = directressObj.GetComponent<DirectressMovement>();
dirMove.Move();
//DiaTrigger trigger = FindObjectOfType<DiaTrigger>();
//trigger.directressStage = 1;
print("MOVING EVENT PLAYED");
// If your sequencer command only does something immediately and then finishes,
// you can call Stop() here and remove the Update() method:
//
Stop();
//
// If you want to use a coroutine, use a Start() method in place of or in addition to
// this method.
}
}
}
Move SequencerCommandAudreyMove.cs out of the Plugins folder. For example, move it into the same folder as DirectressMovement.
Unity compiles everything in Plugins first, without visibility to anything outside of Plugins. Then it compiles everything outside of Plugins. (Scripts outside of Plugins can still see everything that's inside Plugins.)
Tony Li wrote: ↑Wed Sep 02, 2020 8:57 amHappy to help!
One last thing, how can I reference the object in which the dialogue was triggered? So after the first dialogue, I want the sequencer to disable the Dialogue System Trigger, or the Usable component, I tried using " this.gameObject.GetComponent<DialogueSystemTrigger>().enabled = false; " Inside the sequencer but it gives a nullref.
The easiest way is to do it on the Dialogue System Trigger itself. Select Add Action > Set Components Enabled/Disabled. Assign the Dialogue System Trigger itself, and select disabled.
If you want something to happen generically on a Usable, configure the Usable's OnUse() UnityEvent.
Tony Li wrote: ↑Thu Sep 03, 2020 2:49 pm
The easiest way is to do it on the Dialogue System Trigger itself. Select Add Action > Set Components Enabled/Disabled. Assign the Dialogue System Trigger itself, and select disabled.
If you want something to happen generically on a Usable, configure the Usable's OnUse() UnityEvent.
I see, and what would be the best way to re-enable it after?
Example: You reach a NPC which is standing still, he says something like "Oh! You are here, let's go now." And starts moving to a determined point, while he's moving, I don't want players to be able to talk to him, so that's why I assume the Dialogue System Trigger or the Usable component should be disabled. But, after he finishes moving, I want the player to be able to interact again, continuing the conversation.
Another way is to use a Trigger Event. Add a trigger collider at the determined point. Set the Tag Mask to match the NPC's tag. Configure the OnTriggerEnter() event to enable the NPC's Dialogue System Trigger. You can also do the same thing with another Dialogue System Trigger instead of a Trigger Event. Add the Dialogue System Trigger to a trigger collider, and set it to OnTriggerEnter.