How to Disable Button Mashing Between Sequences in Trigger?
Posted: Wed May 03, 2017 5:23 pm
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
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