Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: ChrisFishFern on June 10, 2022, 08:44:40 AM
-
Hi all,
I was wondering if there was a way to create an FSMvariable that held variables (or variable names) so that templates could be made a touch more dynamic.
I currently have a template set up for picking up items, and I want to add an FsmBool switch that is set to true whether specific items are picked up (i.e if a crystal is picked up 'hasCrystal' is set to true). However, I was hoping to use the same template for other items as well, where rather than 'hasCrystal', picking up an ingot would set something like 'hasMetal' to true, and so on. I had the (probably bad) idea of using an input variable to store a variable name, then linking with that within the FSM, so I could just specify the needed variable in the inspector, however I couldn't find any relevant variable types. I assumed if one existed I could find it under FsmObject variable types, however I'm not too sure what I should be looking for. Is this something that is possible, or I am barking up the wrong tree completely?
Thanks in advance for any advice you can give!
Cheers!
-
Hi all,
I was wondering if there was a way to create an FSMvariable that held variables (or variable names) so that templates could be made a touch more dynamic.
I currently have a template set up for picking up items, and I want to add an FsmBool switch that is set to true whether specific items are picked up (i.e if a crystal is picked up 'hasCrystal' is set to true). However, I was hoping to use the same template for other items as well, where rather than 'hasCrystal', picking up an ingot would set something like 'hasMetal' to true, and so on. I had the (probably bad) idea of using an input variable to store a variable name, then linking with that within the FSM, so I could just specify the needed variable in the inspector, however I couldn't find any relevant variable types. I assumed if one existed I could find it under FsmObject variable types, however I'm not too sure what I should be looking for. Is this something that is possible, or I am barking up the wrong tree completely?
Thanks in advance for any advice you can give!
Cheers!
I think a simpler idea might be to create a string array called Inventory, and add "hasCrystal", "hasMetal", etc, when those are picked up. When the player enters a potential scenariowhere they can be used, check if the array includes "hasMetal".
The next level of that idea would be to create a hash list so you can also record how many of those items are in inventory. (search ecosystem for hash actions)
-
Oh, that's an interesting idea! I currently already have an inventory system in place that makes use of scriptable objects and lists which works well, but I just wondered if I could create a bit of a 'catch all' through input variables. If not there are certainly work arounds.
Thanks for the information though! I need to look into arrays and hash lists in PlayMaker more, actually!
I hope you have a great day!