Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Aaddiction on July 09, 2014, 01:19:23 PM

Title: Access "if" statement on a script from FSM
Post by: Aaddiction on July 09, 2014, 01:19:23 PM
Hello, I'm trying with no result so far to make a state to trigger an "if" statement on a script attached to another object or more specifically to set a float on the script. Here's the example:

I need to make "throttleInput" to be "1f;" with an FSM attached to another object, which would in the given example be equivalent to button touch.

Code: [Select]
if (t.phase != TouchPhase.Ended &&
    this.throttleButton != null &&
    this.throttleButton.texture != null &&
    this.throttleButton.texture.HitTest(t.position)){

throttleInput = 1f;

Color c = this.throttleButton.texture.color;
c.a = this.throttleButton.alphaButtonDown;
this.throttleButton.texture.color = c;
}

Any help will be much appreciated.
Title: Re: Access "if" statement on a script from FSM
Post by: Alex Chouls on July 09, 2014, 03:22:31 PM
There's no way to call a specific block of code. What you can do is call Methods or access Variable in your scripts.

So you could put code in a Method and call it from Playmaker using Send Message, Invoke Method, Call Method etc.

Or you can get/set a variable in your script using Get Property and Set Property.

Does that help?