Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: halas on October 30, 2017, 12:55:25 AM

Title: If Statements
Post by: halas on October 30, 2017, 12:55:25 AM
Hey Guys,

Noob here, just curious how I work If statements...

Am I using Bool Values for If statements?
For example,
If (Variable) is true, activate - Trap
If (Variblee) is False, do nothing.
Title: Re: If Statements
Post by: peaks on October 30, 2017, 03:21:42 AM
Hej, you can use the "bool test"-action for your example.
Title: Re: If Statements
Post by: jeanfabre on October 30, 2017, 03:52:29 AM
Hi,

 Peaks is right,

 you'll have state with your "Bool test" action, and two transitions ( like "YES" "NO", "TRUE" "FALSE" "DO THIS" "DO THAT") and the bool test action is going to let you transit to another state based on the value of the fsmvariable you are going to test.

 If you still have problems, I would suggest you either look at some of the videos on youtube for beginners, or check out the various samples on the Ecosystem. to see fsms in actions.



Bye,

 Jean
Title: Re: If Statements
Post by: Alex Chouls on October 30, 2017, 08:38:18 AM
Just to expand on this answer a little, a common pattern is to use questions to name simple branching states, and the event names are the possible answers. So the graph reads more like a flow chart. This pattern is easy to read and understand - important as a project grows and you revisit parts that you made a while ago!
Title: Re: If Statements
Post by: halas on October 30, 2017, 05:09:17 PM
Ok so What I have done:
Bool Test
If "trap" is true -> run trigger.
If "trap" is False, blank

When character steps on plate, trigger event
Bool Flip

But the trap is still running as true
I did check off Every Frame
Title: Re: If Statements
Post by: jeanfabre on October 31, 2017, 01:45:38 AM
Hi,

 Are coming back to that "bool test" state when the player is triggering the platform or plate?

Bye,

 Jean
Title: Re: If Statements
Post by: halas on November 02, 2017, 12:09:48 AM
I got it to work by doing set bool value rather than bool flip.

Doesnt make sense, but hey it works
Title: Re: If Statements
Post by: jeanfabre on November 02, 2017, 02:11:38 AM
Hi,

 yep, in order to test a bool, you need to use bool Test, but maybe in your case your issue is not the test but when to set the bool to the right value for it to be tested later.

 bye,

 Jean