playMaker

Author Topic: Set FSM Int - need help[SOLVED]  (Read 1618 times)

kreegrr

  • Playmaker Newbie
  • *
  • Posts: 2
Set FSM Int - need help[SOLVED]
« on: February 24, 2018, 11:57:26 PM »
Hi guys,

Here's the scenario, create two objects with a FSM on both, create a global INT variable on one of them and try to use 'Set FSM Int' to set it.
Object Name: Object where the Variable resides.
FSM Name: FSM
Variable name, try and find it in the pulldown.. I also tried to type it manually. nope.

No matter what I try, I cant get any variables to show on the action.. I event tried on a single FSM with local variables, no luck.

Can someone try and see if they get it going on their end? Thanks!

Alternative is to bypass the action and code my own, yuck..  :)
« Last Edit: February 26, 2018, 12:48:31 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Set FSM Int - need help
« Reply #1 on: February 25, 2018, 09:20:19 AM »
Hi,
I think you misunderstood how global and local variables work.

A Global variable can be accessed by any fsm, so you can use (for example) the action "set int value"



A local variable can be accessed by using "Get/Set Fsm" actions.

A global is easy to access, but a bad way to code for several reasons :
- they are easy to hack, which means that a cheat engine can access the values very easy
- Many globals tend to get messy and after while it gets hard to see what the variables are for, especially on bigger projects.

A good use for globals is for example if you have a 'game manger' fsm on an object and you have prefabs that needs to connect to the game manager :


kreegrr

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Set FSM Int - need help
« Reply #2 on: February 25, 2018, 10:22:19 AM »
Hi Djaydino,

 Thanks for the explanation,  I tried it this morning and it worked like a charm, I was able to access locals from other FSMs np..Not sure why it wasnt working last night, maybe 01:00am had something to do with it :)

Thanks for the help!.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Set FSM Int - need help[SOLVED]
« Reply #3 on: February 27, 2018, 12:58:37 AM »
Hi.
Happy to help :)