Hello All,
I am quite new to the Dialogue System but am very impressed with its capabilities thus far; it has helped our project greatly. However, the last two days my partner and I have run into an issue involving sequences and player movement, so allow me explain in detail.
We are having issues disabling the keyboard during a sequence that leads into a dialogue, which after you press space, then allows you to move.
We have a..
--Player with his own controller, PlayerController (this handles his movement and attacking, etc)
--Cutscene consisting of a small area, 2 triggers (one for starting and one for landing), and thorns that sprout around locking you inside the cutscene area
Here is the scenario:
You approach the cutscene area and when you step on the first trigger this sequence runs:
[required] SetEnabled(PlayerController, false,Player); (We try to turn off player controls here)
AnimatorPlay(RunUR, Player, 3.1); (We try to play up right animation while hes running)
MoveTo(BatThornEncounterTrigger3, Player, 3.1)->Message(AtRunPoint); (Make him run into cutscene area trigger over 3.1 sec)
AnimatorBool(vineGrowing, true, Vines_01)@3.5; (Make vines grow up and then stay up...)
AnimatorBool(vineGrowing, false, Vines_01)@4; ''
AnimatorBool(vineGrowing, true, Vines_02)@3.6; ''
AnimatorBool(vineGrowing, false, Vines_02)@4.1; ''
AnimatorBool(vineGrowing, true, Vines_03)@3.7; ''
AnimatorBool(vineGrowing, false, Vines_03)@4.2; "
AnimatorBool(vineGrowing, true, Vines_04)@3.8; "
AnimatorBool(vineGrowing, false, Vines_04)@4.3; "
SetActive(Bat_1,true)@3; (Make bat enemies active in cutscene area)
SetActive(Bat_3,true)@3; "
SetActive(Bat_4,true)@3; "
SetEnabled(PlayerController, true,Player)@3.1; (Here we try to foresee player movement @3.1)
SendMessage("setCanMove", "false"); (We tried this as well to try to set his move bool)
After this.. the player runs to another trigger named "BatThornEncounterTrigger3" which is supposed to pop up with a dialogue that says, "Uh oh, I think we might be in trouble". This all works if you don't press any buttons while the MoveTo sequence command is running..however, the problem is that if you mash buttons or press anything within a small time frame between moving triggers, it will lock him into a position and he will run that direction as soon as the dialogue pops up. We are having issues disabling the keyboard during this sequence!
The second trigger sequence code and components is as follows:
Dialogue System Trigger (Script): Play Sequence (This has a conversation linked to it)
AnimatorBool(PlayerMoving, false, Player); (We tried to reposition the player or "0 him out")
AnimatorFloat(MoveX, 0.0, Player);
AnimatorFloat(MoveY, 0.0, Player);
AnimatorFloat(LastMoveX, 0.0, Player);
AnimatorFloat(LastMoveY, 0.0, Player);
SetEnabled(BatController, false, Bat_1); (Turn on bat enemies controllers)
SetEnabled(BatAI, false, Bat_1);
SetEnabled(BatController, false, Bat_3);
SetEnabled(BatAI, false, Bat_3);
SetEnabled(BatController, false, Bat_4);
SetEnabled(BatAI, false, Bat_4);
SetEnabled(PlayerController, false,Player)@.7; (Trying to give player control again)
SendMessage("setCanMove", "true")@1.1 (Also tried send message here to try to give control)
Sequence Trigger (Script): OnConversationEnd (Turns bats AI on)
SetEnabled(BatController, true, Bat_1);
SetEnabled(BatAI, true, Bat_1);
SetEnabled(BatController, true, Bat_3);
SetEnabled(BatAI, true, Bat_3);
SetEnabled(BatController, true, Bat_4);
SetEnabled(BatAI, true, Bat_4);
SetEnabledOnDialogueEvent (Script): OnConversation (We tried this too, setting his controller off during dialogue and on after)
As mentioned above, this works, but we want to bug proof this by making sure you can't just press buttons and run out of the cutscene area before the conversation begins. So the issue is that we are using a lot of @seconds markers and trying to turn the PlayerController on and off between triggers, which works; he will stop and be unable to move when the dialogue pops up but if you press any buttons while hes running in the MoveTo it seems like the key that is being pressed is saving and being pressed immediately as soon the Player lands on the second trigger. The run to the second trigger takes 3.1 seconds so after that we try to re-enable the PlayerController in the second trigger after about half a second (right away it wont work for some reason). We have tried many different scripts and sequencer commands but nothing seems to be working.
If anyone has any experience in this matter or could guide us in the right direction on how to solve this we would be very grateful! Thank you in advance, I know this is a long thread!
-Nik
How to Disable Button Mashing Between Sequences in Trigger?
-
- Posts: 36
- Joined: Wed May 03, 2017 4:34 pm
Re: How to Disable Button Mashing Between Sequences in Trigger?
Hi,
Thanks for using the Dialogue System!
Have you verified that your PlayerController script is actually being disabled during sequences?
One note:
Please feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Thanks for using the Dialogue System!
Have you verified that your PlayerController script is actually being disabled during sequences?
One note:
If your sequence has square brackets around the "required" keyword, please remove them. In the manual, square brackets just mean that the keyword is optional. But when you actually enter the sequence the keyword should not have square brackets around it. It should look like this instead:n_hagialas wrote:[required] SetEnabled(PlayerController, false,Player);
If your PlayerController script is being disabled, is this the only script on your player that listens for input? Is it possible that another script needs to be disabled, too?n_hagialas wrote:required SetEnabled(PlayerController, false,Player);
Please feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
-
- Posts: 36
- Joined: Wed May 03, 2017 4:34 pm
Re: How to Disable Button Mashing Between Sequences in Trigger?
Hey Tony,
Thanks for your quick response!
We removed a bunch of unnecessary components that were making the situation very convoluted. In addition, we removed the brackets around the required as well. However, the issue still remains and the player is now getting stuck in his MoveTo and continuing to run in the same direction that he entered at the first trigger.
We noticed in the console that we were getting this message at exactly that moment, it happens as soon as we hit the second trigger:
Dialogue System: Sequencer.Play( Delay(2)@0 )
Dialogue System: Sequencer: Delay(2)
We have no Delay() code in our sequences so we were wondering why this might be happening?
Revised Sequences below:
Sequence Trigger 1: OnTriggerEnter
required SetEnabled(PlayerController, false,Player);
AnimatorPlay(RunUR, Player, 3.1);
MoveTo(BatThornEncounterTrigger3, Player, 3.1)->Message(AtRunPoint);
AnimatorBool(vineGrowing, true, Vines_01)@3.5;
AnimatorBool(vineGrowing, false, Vines_01)@4;
AnimatorBool(vineGrowing, true, Vines_02)@3.6;
AnimatorBool(vineGrowing, false, Vines_02)@4.1;
AnimatorBool(vineGrowing, true, Vines_03)@3.7;
AnimatorBool(vineGrowing, false, Vines_03)@4.2;
AnimatorBool(vineGrowing, true, Vines_04)@3.8;
AnimatorBool(vineGrowing, false, Vines_04)@4.3;
SetActive(Bat_1,true)@3;
SetActive(Bat_3,true)@3;
SetActive(Bat_4,true)@3;
Trigger 2: (Has 2 scripts)
1. Dialogue System Trigger: Under Action -> Play Sequence (Start Conversation happens here as well)
SetEnabled(PlayerController, false, Player);
AnimatorFloat(LastMoveX, 1.0, Player);
AnimatorFloat(LastMoveY, 1.0, Player);
SetEnabled(BatController, false, Bat_1);
SetEnabled(BatAI, false, Bat_1);
SetEnabled(BatController, false, Bat_3);
SetEnabled(BatAI, false, Bat_3);
SetEnabled(BatController, false, Bat_4);
SetEnabled(BatAI, false, Bat_4);
2. Sequence Trigger: OnConversationEnd (This is where we want the player to stand still with no control until convo is done)
SetEnabled(BatController, true, Bat_1);
SetEnabled(BatAI, true, Bat_1);
SetEnabled(BatController, true, Bat_3);
SetEnabled(BatAI, true, Bat_3);
SetEnabled(BatController, true, Bat_4);
SetEnabled(BatAI, true, Bat_4);
SetEnabled(PlayerController, true,Player);
So the summary is:
Walk on Trigger 1 -> MoveTo(Trigger2) (Player has no control) ->Arrive@Trigger2 -> See Dialogue -> Player Resume control on dialogue end
Thanks!
-Nik
Thanks for your quick response!
We removed a bunch of unnecessary components that were making the situation very convoluted. In addition, we removed the brackets around the required as well. However, the issue still remains and the player is now getting stuck in his MoveTo and continuing to run in the same direction that he entered at the first trigger.
We noticed in the console that we were getting this message at exactly that moment, it happens as soon as we hit the second trigger:
Dialogue System: Sequencer.Play( Delay(2)@0 )
Dialogue System: Sequencer: Delay(2)
We have no Delay() code in our sequences so we were wondering why this might be happening?
Revised Sequences below:
Sequence Trigger 1: OnTriggerEnter
required SetEnabled(PlayerController, false,Player);
AnimatorPlay(RunUR, Player, 3.1);
MoveTo(BatThornEncounterTrigger3, Player, 3.1)->Message(AtRunPoint);
AnimatorBool(vineGrowing, true, Vines_01)@3.5;
AnimatorBool(vineGrowing, false, Vines_01)@4;
AnimatorBool(vineGrowing, true, Vines_02)@3.6;
AnimatorBool(vineGrowing, false, Vines_02)@4.1;
AnimatorBool(vineGrowing, true, Vines_03)@3.7;
AnimatorBool(vineGrowing, false, Vines_03)@4.2;
AnimatorBool(vineGrowing, true, Vines_04)@3.8;
AnimatorBool(vineGrowing, false, Vines_04)@4.3;
SetActive(Bat_1,true)@3;
SetActive(Bat_3,true)@3;
SetActive(Bat_4,true)@3;
Trigger 2: (Has 2 scripts)
1. Dialogue System Trigger: Under Action -> Play Sequence (Start Conversation happens here as well)
SetEnabled(PlayerController, false, Player);
AnimatorFloat(LastMoveX, 1.0, Player);
AnimatorFloat(LastMoveY, 1.0, Player);
SetEnabled(BatController, false, Bat_1);
SetEnabled(BatAI, false, Bat_1);
SetEnabled(BatController, false, Bat_3);
SetEnabled(BatAI, false, Bat_3);
SetEnabled(BatController, false, Bat_4);
SetEnabled(BatAI, false, Bat_4);
2. Sequence Trigger: OnConversationEnd (This is where we want the player to stand still with no control until convo is done)
SetEnabled(BatController, true, Bat_1);
SetEnabled(BatAI, true, Bat_1);
SetEnabled(BatController, true, Bat_3);
SetEnabled(BatAI, true, Bat_3);
SetEnabled(BatController, true, Bat_4);
SetEnabled(BatAI, true, Bat_4);
SetEnabled(PlayerController, true,Player);
So the summary is:
Walk on Trigger 1 -> MoveTo(Trigger2) (Player has no control) ->Arrive@Trigger2 -> See Dialogue -> Player Resume control on dialogue end
Thanks!
-Nik
Re: How to Disable Button Mashing Between Sequences in Trigger?
Hi Nik,
I'll test those out and get back to you later today.
BTW, the "Delay(2)" comes from the conversation. The Dialogue Manager's Default Sequence for conversations is: Delay({{end}}). When the text is short, {{end}} is equal to Min Subtitle Seconds, which defaults to 2.
I'll test those out and get back to you later today.
BTW, the "Delay(2)" comes from the conversation. The Dialogue Manager's Default Sequence for conversations is: Delay({{end}}). When the text is short, {{end}} is equal to Min Subtitle Seconds, which defaults to 2.
Re: How to Disable Button Mashing Between Sequences in Trigger?
Maybe this example scene will be helpful: N_Hagialas_2017-05-04.unitypackage
This is how I set it up:
Sequence Trigger 1 has this Sequence Trigger:
BatThornEncounterTrigger3 (sequence trigger 2) has this Sequence Trigger:
And I put the final sequencer commands on the last dialogue entry of the conversation:
I did this because I didn't know which GameObjects you assigned to the conversation in the Dialogue System Trigger (sequence trigger 2). Only the Dialogue Manager, Actor, and Conversant receive OnConversationEnd events. If the third sequence trigger isn't the Actor or Conversant, it won't receive the OnConversationEnd event, so it won't run.
This is how I set it up:
Sequence Trigger 1 has this Sequence Trigger:
BatThornEncounterTrigger3 (sequence trigger 2) has this Sequence Trigger:
And I put the final sequencer commands on the last dialogue entry of the conversation:
I did this because I didn't know which GameObjects you assigned to the conversation in the Dialogue System Trigger (sequence trigger 2). Only the Dialogue Manager, Actor, and Conversant receive OnConversationEnd events. If the third sequence trigger isn't the Actor or Conversant, it won't receive the OnConversationEnd event, so it won't run.
-
- Posts: 36
- Joined: Wed May 03, 2017 4:34 pm
Re: How to Disable Button Mashing Between Sequences in Trigger?
Tony,
I think we solved the problem! We tried your steps but there wasn't much of a change. In order to fix the problem we had to create methods to turn off the canMove variable in our own Player Controller using SendMessage and turn off the animatorbool PlayerMoving in the animator as soon as the player hit the first trigger. Then we turn these values back on after the conversation ends.
So this is what it ended up looking like:
Trigger 1:
required SetEnabled(PlayerController, false,Player);
required AnimatorPlay(RunUR, Player, 3.1);
required MoveTo(BatThornEncounterTrigger3, Player, 3.1)->Message(AtRunPoint);
SendMessage(setCanMove, false, Player)@.1;
AnimatorBool(PlayerMoving, false, Player);
required AnimatorPlay(Mask Idle Up Right, Player, 1)@3.2;
Trigger 2 part 1:Dialogue System Trigger
SetEnabled(PlayerController, true, Player);
AnimatorFloat(LastMoveX, 1.0, Player);
AnimatorFloat(LastMoveY, 1.0, Player);
(At start of Conversation run this sequence)
required SetEnabled(PlayerController, false,Player);
Trigger 2: (OnConversationEnd)
SetEnabled(PlayerController, true,Player);
SendMessage(setCanMove, true, Player)@.1;
AnimatorBool(PlayerMoving, true, Player)@.1;
We also force the Player to face the right direction until conversation ends as well so that he doesnt turn.
This prevents the player from mashing buttons to put the character out of place before the cutscene dialogue ends.
Thanks again,
-Nik
I think we solved the problem! We tried your steps but there wasn't much of a change. In order to fix the problem we had to create methods to turn off the canMove variable in our own Player Controller using SendMessage and turn off the animatorbool PlayerMoving in the animator as soon as the player hit the first trigger. Then we turn these values back on after the conversation ends.
So this is what it ended up looking like:
Trigger 1:
required SetEnabled(PlayerController, false,Player);
required AnimatorPlay(RunUR, Player, 3.1);
required MoveTo(BatThornEncounterTrigger3, Player, 3.1)->Message(AtRunPoint);
SendMessage(setCanMove, false, Player)@.1;
AnimatorBool(PlayerMoving, false, Player);
required AnimatorPlay(Mask Idle Up Right, Player, 1)@3.2;
Trigger 2 part 1:Dialogue System Trigger
SetEnabled(PlayerController, true, Player);
AnimatorFloat(LastMoveX, 1.0, Player);
AnimatorFloat(LastMoveY, 1.0, Player);
(At start of Conversation run this sequence)
required SetEnabled(PlayerController, false,Player);
Trigger 2: (OnConversationEnd)
SetEnabled(PlayerController, true,Player);
SendMessage(setCanMove, true, Player)@.1;
AnimatorBool(PlayerMoving, true, Player)@.1;
We also force the Player to face the right direction until conversation ends as well so that he doesnt turn.
This prevents the player from mashing buttons to put the character out of place before the cutscene dialogue ends.
Thanks again,
-Nik
Re: How to Disable Button Mashing Between Sequences in Trigger?
Hi Nik,
Great! Sorry I wasn't much help on this one. If I can help out with anything else, just let me know.
Great! Sorry I wasn't much help on this one. If I can help out with anything else, just let me know.
-
- Posts: 36
- Joined: Wed May 03, 2017 4:34 pm
Re: How to Disable Button Mashing Between Sequences in Trigger?
No worries! Looking at your stuff definitely helped give us some ideas. The immediate responses are really helpful.