Animation Problems writing a sequence

Announcements, support questions, and discussion for the Dialogue System.
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: Animation Problems writing a sequence

Post by OneManOnMars »

Awesome! I'll give this a try!

Speaking of writing a sequence command. I am trying do exactly do that. My command should flip the object(character) if he walks/looks into the other direction. So I checked the documentation. Sadly most of the scripts are blocked away behind dlls so I can't look at them. MoveTo would have been interesting I guess.

What I try to do is this:

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

namespace PixelCrushers.DialogueSystem.SequencerCommands {

	public class SequencerCommandFlipObject : SequencerCommand {

		public void Start() {
            // 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.
            //
            // If your sequencer command only does something immediately and then finishes,
            // you can call Stop() here and remove the Update() method.
            string objectName = GetParameterAsSting(0);
            GameObject flipObject = GameObject.Find("objectName");
            flipObject.transform.scale.x *= -1;
            Stop();
		}
		
	
		
	}

}
As you can imagine, this does not work! Geting a parameter as a string does not exist as the internet suggests.
Is there a way to look into the dlls? I am confident that I could figure this one out.
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: Animation Problems writing a sequence

Post by OneManOnMars »

Tony Li wrote:
1. Create a Conversation Trigger on a uniquely-named GameObject. Let's say it's called "ConvStarter".

2. Configure the Conversation Trigger's conversation, actor, and conversant. Set the trigger to OnUse.

3. In the sequence, use a command like this:

Code: Select all

SendMessage(OnUse,,ConvStarter)
Works like a breez! Thank you!
User avatar
Tony Li
Posts: 21081
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animation Problems writing a sequence

Post by Tony Li »

Hi,

BTW, full source code is included. Here's how to unpack it: instructions. You can find the MoveTo command in Assets/Dialogue System/Scripts/Core/Model-View-Controller/View/Sequencer/Sequencer Commands/SequencerCommandMoveTo.cs.

Change these lines:

Code: Select all

string objectName = GetParameterAsSting(0);
GameObject flipObject = GameObject.Find("objectName");
to:

Code: Select all

string objectName = GetParameter(0);
GameObject flipObject = GameObject.Find(objectName);
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: Animation Problems writing a sequence

Post by OneManOnMars »

:D Thank you very much! I am very happy right now! So much is working at the end of the long working day. Thanks Tony for guiding me trough the mist.

By the way this is how the commandscript looks now. For anyone to use:

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

namespace PixelCrushers.DialogueSystem.SequencerCommands {

	public class SequencerCommandFlipObject : SequencerCommand {

		public void Start() {

            string objectName = GetParameter(0);
            GameObject flipObject = GameObject.Find(objectName);

            Vector3 flipValue = flipObject.transform.localScale;
            flipValue.x *= -1;
            flipObject.transform.localScale = flipValue;
            Stop();
		}

		
	}

}
User avatar
Tony Li
Posts: 21081
Joined: Thu Jul 18, 2013 1:27 pm

Re: Animation Problems writing a sequence

Post by Tony Li »

Awesome! Thanks for sharing!
Post Reply