playMaker

Author Topic: Multiple Get/Set Property, Get/Set FSM Variables for external scripts? [SOLVED]  (Read 1853 times)

Thore

  • Sr. Member
  • ****
  • Posts: 480
Hello Everyone!

I searched here and the ecosystem but couldn't find it. I'm looking for a robust method to get/set several variables from an external script (object) to an FSM.

What I'm trying to do
I like to have the important and essential variables of a game object in one place, and in a nice list, so they can be tweaked and balanced more easily, think Character Sheet. However, they are needed in different FSMs and get/set.

Problems & Assumptions
  • I am aware of the "Get/Set Property" method, but it only allows for one property per action. It would have to be repeated many times to get/set several variables. Also, variable names in the FSM need to be created manually.
  • I could use one FSM as a variable "holder", and use get/set FSM variables to communicate with other FSMs, but they make for a chaotic list, but at least they are consistent across them.
  • Using global variables somehow strikes me as a bad idea.

Current: Hack
I made a simple variable holder script, think Character Sheet, that keeps all the important high level variables in one place (think Running Speed, Damage etc). Then I reference this component as an object (drag/drop component into variable list), then I use get/set property multiple times until I got the various variables I need. I don't like this method, because it looks hacky and seems not very efficient.

Solutions Ideas
  • An action that can fetch and write (get/set) a number of variables at once from an object (script/component).
  • Wrapping my script in such a way that playmaker accepts it as one action, and once in the FSM format, use the FSM-to-FSM communication to spread them around

Can someone point me to a resource that does this, give me a pointer how to solve this (I'm a non-programmer), or a solution that would be good, or reassure me that my solution I use already is good enough? (any feedback welcome)

Thanks in advance! :)
« Last Edit: March 16, 2017, 05:39:53 PM by Thore »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 if you are not a programmer, this is a very good approach, of course written few custom actions would likely improve on clarity.

for non programmers, there is only GetProperty and SetProperty to access non fsm variables on components.

 Bye,

 Jean

Thore

  • Sr. Member
  • ****
  • Posts: 480
Thanks Jean!

Edit: by happenstance found this tutorial, maybe it's of use to someone.
Tutorial: How to create C# interface scripts for Playmaker and Behavior Designer



« Last Edit: March 16, 2017, 03:15:09 PM by Thore »