playMaker

Author Topic: Help with Playmaker Actions: Newbie[SOLVED]  (Read 464 times)

FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Help with Playmaker Actions: Newbie[SOLVED]
« on: February 12, 2019, 12:26:21 PM »
Hi,

I'm still new to playmaker, although I made some progress today :) ..However, I'm still somewhat struggling with the actions and how to link them properly, so that they do what I want.

I am trying to get the logic here for two actions, I'd like to have executed in my current scene.

The first thing is:

I got the asset 'Pixel Crusher's Dialogue System' and I'm using Playmaker to execute the dialogues. Playing the first dialogue works fine.

But what I'm trying to achieve now, is that a new dialogue plays, after the first dialogue has been read through, without ever going back to the first dialogue. (Attached screenshot below)

I'm pretty sure I should use bools, tried for a long time to find tutorials that shows me exactly what I need, I read the documentation and tried many different ways, but there is something I'm missing, because I can't get it to work.

Is there any way to get a step by step guide on this for newbs like me?

Then the second thing I'm trying to achieve is:
A text gets released in the scene, with 'on trigger enter' on an object. The player reads through the text and is told that he can do an action with the 'Enter' Key after discovering this object.
The text shows up on the screen fine, but now I would like to change scenes after the player presses the 'Enter' key (right after reading the text).

I used 'Get Key Down', but it's not working with the scene switch. I added the 'Load Scene' Action and it changes scenes directly when the player gets in collision with the object, without having time to read the text or press the 'Enter' key.

Is there generally a way to make sure States play one after the other? Any advice?

Thanks for your patience with all the newbie questions :)
Here are the screenshots:
https://ibb.co/b3kvPfX
https://ibb.co/3CLwyhZ
https://ibb.co/QQY5qGB

« Last Edit: February 26, 2019, 11:53:29 PM by jeanfabre »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3581
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Help with Playmaker Actions: Newbie
« Reply #1 on: February 12, 2019, 12:55:13 PM »
State changes are triggered by events. The FSM will stay in a state until it receives an event that triggers a transition to another state.

I think you might be confused about the FINISHED event. It is sent automatically when all actions on a state have finished running. This might be pushing you to the next state quicker than you want.

Instead of using FINISHED, try making your own events in the Events tab and send them yourself. That way you have complete control and will understand how to build the flow better. For example, the Bool Test action lets you send events based on the value of Bool variable. I know that might not make sense yet, but I think if you start playing with making and sending events it will start to make sense!

FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #2 on: February 13, 2019, 06:01:18 AM »
Hi,

So I stopped using FINISHED and made my own events.

I'm still on the bit where I want to have a new dialogue play once the first dialogue has finished playing.
I looked into PlayerPrefs and bools. I downloaded ECOSYSTEM and imported the package into Unity, in order to be able to use 'PlayerPrefs Bool Test', 'PlayerPrefs Set Bool' Actions etc.

So basically, the system has to check if Conversation 1 already occurred, using a bool, and if it has, it goes to play Conversation 2. I get that.

I've been trying out different options but somehow can't get it to work. I tried to find a tutorial specifically on PlayerPrefs bool Actions, but have not been able to. I am still confused on how to make it work with Playmaker. I took some screenshots:
https://ibb.co/VWwCwfB
https://ibb.co/hLnpJz9
https://ibb.co/GdBm3c4
https://ibb.co/GHKGpMY
https://ibb.co/yRPG6TY

I'd really appreciate some help

State changes are triggered by events. The FSM will stay in a state until it receives an event that triggers a transition to another state.

I think you might be confused about the FINISHED event. It is sent automatically when all actions on a state have finished running. This might be pushing you to the next state quicker than you want.

Instead of using FINISHED, try making your own events in the Events tab and send them yourself. That way you have complete control and will understand how to build the flow better. For example, the Bool Test action lets you send events based on the value of Bool variable. I know that might not make sense yet, but I think if you start playing with making and sending events it will start to make sense!
« Last Edit: February 13, 2019, 11:05:21 AM by FunD »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14059
  • Official Playmaker Support
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #3 on: February 15, 2019, 01:01:58 AM »
Hi,

 you need to put your event as global transitions ( above the state), else they won't trigger because they are transitions of other states ( below the state).

 so simply move your Play Conversation X and Stop Conversation Y at the top of states, and run logic on trigger enter to dispatch to various states this way.

 Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4120
    • View Profile
    • jinxtergames
Re: Help with Playmaker Actions: Newbie
« Reply #4 on: February 15, 2019, 01:24:57 PM »
Hi.
maybe this tutorial can help :


FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #5 on: February 19, 2019, 07:09:14 AM »
Hi,
I tried using global transitions, but then the dialogues don't play at all anymore. I really am not sure why.

This is basically what I need:
On trigger -> plays Dialogue 1 (this works) -> on second trigger plays Dialogue 2 -> on third trigger and so on -> plays Dialogue 2 repeatedly

I also need to add a function where the player freezes his position while having a dialogue with a NPC and is only able to move once the dialogue is over.

Should I maybe message someone from Playmaker support directly and send that scene of my Unity project at this point?
I am using 'Pixel Crushers' Dialogue System Asset, and followed an online tutorial on how to call dialogues and play them with Playmaker. However, I could not find a tutorial on how to add conditions, such as replaying a conversation or playing the next one, so I'm still kind of stuck on this.
thank you very much for your help so far



Hi.
maybe this tutorial can help :


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4120
    • View Profile
    • jinxtergames
Re: Help with Playmaker Actions: Newbie
« Reply #6 on: February 19, 2019, 10:37:21 PM »
Hi,
Can you show an image of the fsm?

FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #7 on: February 21, 2019, 06:03:08 AM »
Hi,
This is the tutorial about using pixel crusher with playmaker, btw:
https://www.youtube.com/watch?v=41UkBz2Wdbc&t=242s

The dialogues are released on trigger through collision with NPCs.

So if I make a State that has a transition 'Trigger Enter', this state leading to a second State that has an action 'Start Conversation', it plays the conversation of Pixel Crusher Dialogue System.

I noticed that I can't add a 'TRIGGER ENTER' transition on a state more than once, so I created a second event called 'TRIGGER ENTER: Second Convo'
The first transition plays Conversation 1, and the second one should play Conversation 2, once Conversation 1 played (so after colliding with NPC a second time). But it does not.
State 4 is linked back to State 1, because I want the second convo to play again repeatedly.
You can set variables with the Pixel Crusher dialogue system actions, so I tried with a Bool, but can't get it work.
If you want a second action to be released through 'trigger enter' with Playmaker, once action 1 is finished executing, would you use a bool, or how would you do it?
Also, how would I freeze the player's position during conversations, while still allowing him to look around? Is there an action for this?
Thank you for your help.
Screenshots:

https://ibb.co/B2CV201
https://ibb.co/7vft960
https://ibb.co/tzHQjBC
https://ibb.co/wMfsLDj
https://ibb.co/Hhvf57f
https://ibb.co/2WjsqqT
https://ibb.co/pwK7Nsj

Hi,
Can you show an image of the fsm?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4120
    • View Profile
    • jinxtergames
Re: Help with Playmaker Actions: Newbie
« Reply #8 on: February 21, 2019, 07:47:15 AM »
Hi.
Yes you can not use The same Transition name more than once on a state.

The 'TRIGGER ENTER' is a pre made event, whick works similar to the 'Trigger Event' action.

You might want to use that instead to understand better the usage of this.

If only 2 conversations you could set up like this :

State 1 :
Have TRIGGER ENTER Transition or use the trigger event action and make an event name (call it 'Start Dialogue' for example) and use that to go to the next state.

State 2 :
Do the dialogue in there.
You could also send an event to the fsm which handles the movement. in there have a state "Disabled' and have a global transition event (call it "Disable Move" for example) connected to that state.
Then also have global transition event to the state where you handle the movement. (call it "Enable Move" for example)

I don't know If the "start conversation" Finish when conversations is ended or immediately as i do not have the asset. (you might need another action for it)

State 3 :
Send event (Enable Move) to you movement fsm.

Then have another trigger event action or TRIGGER ENTER transition.

state 4 :
Do 2nd dialogue.


if you would have several dialogues then you could do this :

State 1 :
Have a trigger event.

State 2 :
Have a "int Add" and add 1 to a variable (name it "Current Conversation" for example")

State 3 have a "int Switch" and place the variable in it.
Then in 'Int Switches' set the amount of conversations you have (4 for example)

Then make 4 states (one for each conversation) and make 4 events (one for each conversation) and use them in the "int Switch"  action.
On compare int, set 1,2,3,4

From each conversation state loop back to the 1st state.

In the last Conversation you could add a "Set Int Value" and set the the value "Current Conversation" to 0
This would start the conversation sequence from the beginning again

FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #9 on: February 25, 2019, 11:19:20 AM »
Hello,

Thanks for your message. I tried both options, it still hasn't worked, unfortunately.

What I noticed so far with all options I tried, is that there is no second conversation playing 'on trigger enter', using this asset as an action in playmaker (unless I'm doing it wrong).

So you are right, the problem is probably, that another action is needed to start a new conversation. (Quote: I don't know If the "start conversation" Finish when conversations is ended or immediately as i do not have the asset. (you might need another action for it)

I've looked in the actions provided by the Pixel Crusher Dialogue System, and the one thing I could find, that I thought would apply here, is the "Stop Conversation" action. (Screenshots below)

However, it still won't play a second convo.

One more question I have as well is, which Playmaker action can I use to freeze the player's position?

Thank you.
Screenshots:
https://ibb.co/TH1FzbF
https://ibb.co/RP7BGb9
https://ibb.co/RDkp0JW

Hi.
Yes you can not use The same Transition name more than once on a state.

The 'TRIGGER ENTER' is a pre made event, whick works similar to the 'Trigger Event' action.

You might want to use that instead to understand better the usage of this.

If only 2 conversations you could set up like this :

State 1 :
Have TRIGGER ENTER Transition or use the trigger event action and make an event name (call it 'Start Dialogue' for example) and use that to go to the next state.

State 2 :
Do the dialogue in there.
You could also send an event to the fsm which handles the movement. in there have a state "Disabled' and have a global transition event (call it "Disable Move" for example) connected to that state.
Then also have global transition event to the state where you handle the movement. (call it "Enable Move" for example)

I don't know If the "start conversation" Finish when conversations is ended or immediately as i do not have the asset. (you might need another action for it)

State 3 :
Send event (Enable Move) to you movement fsm.

Then have another trigger event action or TRIGGER ENTER transition.

state 4 :
Do 2nd dialogue.


if you would have several dialogues then you could do this :

State 1 :
Have a trigger event.

State 2 :
Have a "int Add" and add 1 to a variable (name it "Current Conversation" for example")

State 3 have a "int Switch" and place the variable in it.
Then in 'Int Switches' set the amount of conversations you have (4 for example)

Then make 4 states (one for each conversation) and make 4 events (one for each conversation) and use them in the "int Switch"  action.
On compare int, set 1,2,3,4

From each conversation state loop back to the 1st state.

In the last Conversation you could add a "Set Int Value" and set the the value "Current Conversation" to 0
This would start the conversation sequence from the beginning again

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4120
    • View Profile
    • jinxtergames
Re: Help with Playmaker Actions: Newbie
« Reply #10 on: February 26, 2019, 03:14:44 AM »
Hi.
On the 1st screenshot : https://ibb.co/TH1FzbF

State 4 and 5 (covo 1, convo 2) should have a finished event and transition them to state 1 (On Trigger)

i made a sample scene to see how it works. (Attachment below)
Just with some set text and a wait,
It also has send event to show you how you can disable movement.
The drag is just optional, you could also use set velocity and set it to 0,0,0 on the disable state to let it stop directly.

FunD

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Help with Playmaker Actions: Newbie
« Reply #11 on: February 26, 2019, 08:47:17 AM »
Many thanks.

Hi.
On the 1st screenshot : https://ibb.co/TH1FzbF

State 4 and 5 (covo 1, convo 2) should have a finished event and transition them to state 1 (On Trigger)

i made a sample scene to see how it works. (Attachment below)
Just with some set text and a wait,
It also has send event to show you how you can disable movement.
The drag is just optional, you could also use set velocity and set it to 0,0,0 on the disable state to let it stop directly.