Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: PINKCANNON on November 01, 2017, 05:12:25 AM

Title: [SOLVED]Start a fsm or action sequence when int value reaches a specific number?
Post by: PINKCANNON on November 01, 2017, 05:12:25 AM
Hello

I am new to Playmaker and scripting in general... so with that being said, here are my noobish questions.

I have a global int variable converted to a string to show onto the UI.
I want to activate actions/fsm everytime the int value reaches a milestone that I could set but don't know how to do that either.

Random but related Scenario:
My car rolls and at every 25km I would like for a big red light to flash and tell me that I am out of gasoline...

How could I achieve that with my variables?


Title: Re: Start a fsm or action sequence when string/int value reaches a specific number?
Post by: djaydino on November 01, 2017, 05:39:06 AM
Hi,
It depends a bit on your setup, but here are some ideas :

You can use some 'int compare' actions on the int variable. for each milestone.

or you can use a single 'int compare' but set a variable and add 25 after each milestone to compare to that global.

You can find many tutorials on the User Tutorial Wiki Page (https://hutonggames.fogbugz.com/default.asp?W548) to get you familiar with playmaker.

btw: a Tip : you should try to minimize using globals.
you can use "get/set fsm" actions to get/set local variables on fsms
Title: Re: Start a fsm or action sequence when string/int value reaches a specific number?
Post by: PINKCANNON on November 01, 2017, 05:47:17 AM
Hi,
It depends a bit on your setup, but here are some ideas :

You can use some 'int compare' actions on the int variable. for each milestone.

or you can use a single 'int compare' but set a variable and add 25 after each milestone to compare to that global.

You can find many tutorials on the User Tutorial Wiki Page (https://hutonggames.fogbugz.com/default.asp?W548) to get you familiar with playmaker.

btw: a Tip : you should try to minimize using globals.
you can use "get/set fsm" actions to get/set local variables on fsms

Thank you! I will give it a look.
And it's a one scene game. I have 2 globals set up my int & string and thats it. I only need those. The milestone is to activate upgrade buttons each time player reaches a specified value. A type of clicker game but with an end since i don't want to get into math to much.
Title: Re: [SOLVED]Start a fsm or action sequence when int value reaches a specific number?
Post by: PINKCANNON on November 01, 2017, 06:28:34 AM
Did the int compare method and worked like a charm. Thank you again!
Title: Re: [SOLVED]Start a fsm or action sequence when int value reaches a specific number?
Post by: djaydino on November 01, 2017, 09:02:25 AM
Hi,
No Problem :) happy to help