Page 2 of 2

Re: Animation Problems writing a sequence

Posted: Thu Mar 23, 2017 3:30 pm
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.

Re: Animation Problems writing a sequence

Posted: Thu Mar 23, 2017 3:36 pm
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!

Re: Animation Problems writing a sequence

Posted: Thu Mar 23, 2017 3:39 pm
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);

Re: Animation Problems writing a sequence

Posted: Thu Mar 23, 2017 5:18 pm
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();
		}

		
	}

}

Re: Animation Problems writing a sequence

Posted: Thu Mar 23, 2017 8:55 pm
by Tony Li
Awesome! Thanks for sharing!