How can I change the value with sequence?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Frioniel
Posts: 13
Joined: Fri Sep 22, 2017 9:25 am

How can I change the value with sequence?

Post by Frioniel »

Hello,

Currently I'm using the Dialogue System with Corgi Engine.

What I want to do is My Player Character(PC) can use double jump after the conversation(event?).

--------------------------------------------------------------------------------------------------------

So this is How I tried for the function.

I made 2 game object.

1. My PC with components named Character Jump(Corgi Engine Script)
2. Event Trigger with component named Conversation Trigger(Dialogue System), Box collider 2D(for trigger).

First.
I set the variable named Number of Jumps in Character Jump script to 1 for single jump. (if the value is 2, PC can use double jump)

After that, I made a conversation work when my PC pass the Event trigger.

-----------------------------------------------------------------------------------------------------

Here's the problem

I tried the Sendmessage sequence and Dialogue System Events function but, it doesn't work.
(I just read document to make it, but probably I don't understand how to use it and I wonder is it right way to make what I want.)

Is there's a way solve the problem?
Attachments
2.png
2.png (156.94 KiB) Viewed 701 times
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I change the value with sequence?

Post by Tony Li »

Hi,

Here's an example scene: CorgiSetJumpsExample_2017-09-23.unitypackage

I wrote a small sequencer command. (I'll also post the code below.) To use it, I added a dialogue entry to Dude 1's conversation that uses this sequence:
  • Dialogue Text: "Abracadabra! Now you can double jump!"
  • Sequence: SetJumps(2); Delay({{end}})
SequencerCommandSetJumps.cs

Code: Select all

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

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandSetJumps : SequencerCommand
    {
        public void Start()
        {
            var maxJumps = GetParameterAsInt(0);
            Debug.Log("Setting player max jumps to " + maxJumps);
            foreach (var player in FindObjectOfType<MoreMountains.CorgiEngine.LevelManager>().Players)
            {
                player.GetComponent<CharacterJump>().NumberOfJumps = maxJumps;
            }
            Stop();
        }
    }
}
Frioniel
Posts: 13
Joined: Fri Sep 22, 2017 9:25 am

Re: How can I change the value with sequence?

Post by Frioniel »

Sorry for late reply.

It worked well!

Thanks for the help!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I change the value with sequence?

Post by Tony Li »

Happy to help!
Post Reply