Forum rules - please read before posting.

Linking a PlayMaker Variable to an AC Global Variable realtime: check variable question.

per User Manual 1.4.1b, sec 7.3, I'm trying to use AC’s ability to link a global variable with a PlayMaker global variable. I am using an AC inventory interaction to:

  1. run a PlayMaker FSM which increments a global variable by 1 within the FSM
  2. update the AC global variable to have new value as soon as that happens.

The problem is, the check variable action (in which, if I understand the manual correctly, I compare the AC global variable to itself to ‘download’ from PM to AC) does not affect AC global variable by the end of the interaction.

If I do a check variable action in a *later* interaction, I do get the new value. But the problem is, my goal is to use the global variable as a score, so that the AC global variable is used by the AC menu manager to keep a Unity UI element constantly updated. I always need it to be current, not just updated when some later event happens.

Is this possible? Maybe this isn’t really what the intent of the PM link was for, but if it could happen it would be great.

PS: I’ve just stumbled on a thread Deeper PlayMaker Integration which may be broadly relevant.

For context: the reason for me to have PlayMaker global variables be involved is because PlayMaker is integrated with Behavior Designer. AC’s inventory manager, hotspot interactions, and especially the menu managersintegration with Unity UI is very attractive to me, but I also want global variables that can be affected by many different things to influence a behavior tree, so the realtime synching of global variables is something I'm hoping for.

Comments

  • Checking a PM-linked variable should give you the real value, and update the AC one.  I will check that things are still working correctly.
  • OK- yes I think I've figured it out, my incrementing action in PlayMaker was not set correctly, I needed it on an earlier state. thanks!
  • For some reason I can't make it work. String values are updating automatically without any problems (just have to "check" variable), but float (and int) are always showing zero.. Not sure what am I missing...
  • Which versions of AC and Playmaker, and is Use PM for initial value? checked in the Variables Manager?
  • edited November 2017
    AC 1.59e PM 1.8.5.f8

    I had that chekmark checked, yes, and value would drop to zero.

    Interestingly, I just tried without it checked, and scene became unresponsive - active zones won't react on mouseover or on clicks..

    no mismatch in variable types either, i tried bot int and float.

    (oh. and unrelated question - is there an option to have something like switch-case or if-elseif-elseif for int variables, not popups? for instance, to send a message when fuel level (which is normally 1 to 100) reaches 50, 25, and 10? All I can imagine now is to create daisy-chained variable checks, or separate pop-up variable..)
  • I'm afraid I can't recreate the issue with those same version numbers - floats, ints and strings work OK for me.

    Were you previously linking those variables to something else, e.g. Options data?  It may be a shot in the dark, but try clearing the options cache from the bottom of the Settings Manager.

    If the scene hasa become unresponsive, check List active ActionLists in Game window?, also at the bottom of the Settings Manager.  That should hopefully indicate why it's unresponsive, e.g. because a gameplay-blocking ActionList is running indefinitely.

    As for variable switching, the Variable: Pop up switch Action can be used to do that for PopUp variables.

  • Thank you, Chris. It looks like it happens only with one particular variable. I still don't see the reason, but suspect that it's more of PM problem or simply my error somewhere.
    Thanks!
  • So you need to do the actionlist 'check variable' every time you change a linked variable in Playmaker? Seems to be the only way I can get the AC variables to update.
  • The AC variable is updated when its value is requested.  This is done automatically when using Variable: Check, but you can also do it through script:

    GVar myVar = GlobalVariables.GetVariable (2); // Where 2 is the variable's ID number
    myVar.Download ();
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.