Page 1 of 1

Sequencer not recognizing my scripts.

Posted: Tue Sep 01, 2020 7:14 pm
by mac
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

Code: Select all

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.
        }

    }

}

Re: Sequencer not recognizing my scripts.

Posted: Tue Sep 01, 2020 7:51 pm
by Tony Li
Hi,

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.)

Re: Sequencer not recognizing my scripts.

Posted: Wed Sep 02, 2020 1:48 am
by mac
Fixed. Thank you Tony !

Re: Sequencer not recognizing my scripts.

Posted: Wed Sep 02, 2020 8:57 am
by Tony Li
Happy to help!

Re: Sequencer not recognizing my scripts.

Posted: Thu Sep 03, 2020 2:38 pm
by mac
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.

Thanks in advance Tony.

Re: Sequencer not recognizing my scripts.

Posted: Thu Sep 03, 2020 2:49 pm
by Tony Li
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.

Re: Sequencer not recognizing my scripts.

Posted: Thu Sep 03, 2020 5:55 pm
by mac
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.

Re: Sequencer not recognizing my scripts.

Posted: Thu Sep 03, 2020 9:43 pm
by Tony Li
If you're moving using a script, then just enable the Dialogue System Trigger at the end of the script's work:

Code: Select all

GetComponent<DialogueSystemTrigger>().enabled = true;
If you're moving using a sequence, use the SetEnabled() sequencer command at the end. Example (assumes this sequence runs on the 'speaker'):

Code: Select all

SetEnabled(DialogueSystemTrigger,false);
MoveTo(ADeterminedPoint,,3)->Message(Arrived);
SetEnabled(DialogueSystemTrigger,true)@Message(Arrived)
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.

Re: Sequencer not recognizing my scripts.

Posted: Thu Sep 03, 2020 11:15 pm
by mac
Perfect, Thanks Tony!

Re: Sequencer not recognizing my scripts.

Posted: Fri Sep 04, 2020 8:29 am
by Tony Li
Happy to help!