Page 1 of 1

How can I change the value with sequence?

Posted: Fri Sep 22, 2017 9:34 pm
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?

Re: How can I change the value with sequence?

Posted: Sat Sep 23, 2017 8:51 am
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();
        }
    }
}

Re: How can I change the value with sequence?

Posted: Wed Sep 27, 2017 10:34 pm
by Frioniel
Sorry for late reply.

It worked well!

Thanks for the help!

Re: How can I change the value with sequence?

Posted: Wed Sep 27, 2017 10:54 pm
by Tony Li
Happy to help!