playMaker

Author Topic: Challenge without IF conditions?  (Read 1895 times)

speccy666

  • Playmaker Newbie
  • *
  • Posts: 8
Challenge without IF conditions?
« on: January 20, 2016, 12:17:55 PM »
Hi all, I have some problem in advanced use of PLAYMAKER.
I began a simple game to test the monty paradox.

The program shows 3 closed doors with one treasure behind only one.
You select one door and the program opens another door without any treasure before you open your selected door.
Then It proposes to you to keep your choice or try the other door by clicking on the door.

In the algorithm, I want a “manager” that do actions according to a global variable.
For example, if a first door has been selected, the computer opens another door;

a state with a transition which is the global variable “FirstDoorSelected”
If FirstDoorSelected=true then Gameobject.EnableFSM(FSM2)=true…leads to the animation of the door opening.

So the playmaker script has to react to a click on a door and do different things according to the global variable states

More generally, I probably need to use conditions IF….. but cannot find on internet or forums any accurate ideas…. (I watched all Hutong tutorial Videos, here no triggers to set a variable!)

Do you have any idea? Thanks for reading my bad English…
 :)

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
Re: Challenge without IF conditions?
« Reply #1 on: January 20, 2016, 01:00:38 PM »
Hello,

As far as I know, Playmaker doesn't have a plain "If statement", however you can get around this by different actions.

For example, instead of testing if a variable changed from "Closed" to "Open"; you can use the "Int Compare" or "Float" Compare action. It basically compares the value of a variable (int or float depending on what you want) with another value, if true (which equates if it changed to this value really) do this, if false, do that.

So to do this, you'd create a variable "float" called "doorStatus" and set it to 0 (which is closed). Then to test this, I use an action "Float Compare" and test for 1. If value is 1 = then open the door and let player in. If value is less, keep door closed. If value is greater, open the door and let the player in (just a precaution in case I did something wrong in my code).

Hope that helps.

speccy666

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Challenge without IF conditions?
« Reply #2 on: January 20, 2016, 02:35:44 PM »
Thanks! this is interesting....!

I try finally to make a link between Java script in Unity and Playmaker; this seem to be quite easy with this tutorial :

I hope it can help....