playMaker

Author Topic: Disable Array of Objects  (Read 119 times)

stvbabb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Disable Array of Objects
« on: October 24, 2017, 01:30:24 AM »
Hello,

I'm trying to load some game objects into an array using Playmaker and then either activate or deactivate them as a large group. Is this possible? I'm trying to not use Arraymaker as I kind of like the included Array actions a bit better as it  seems less messy to me.

I also realize I could group all of these separate objects into one game object and just deactivate that, but the problem is that it's for a rather complex UI and messing up my hierarchy could lead to further confusion.

I do see how to do this quite easily with Arraymaker, but just wondering if there is a simpler way with the included actions.

Thanks,
Steve

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2265
    • View Profile
    • jinxtergames
Re: Disable Array of Objects
« Reply #1 on: October 24, 2017, 01:25:36 PM »
Hi,
This should be possible.
Where are you stuck?

stvbabb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Disable Array of Objects
« Reply #2 on: October 26, 2017, 11:58:01 PM »
Hi djaydino,

I kept attempting to do this way array get next, however, I'm wasn't sure about about to actually get the next game object variable and do something with it. I follows along with the always great mdot, but if I wanted to get the next variable from an array... I guess what decides the next one and then how do I do something with it once I have it? Sorry, I may be confusing the topic.

I watched this and it helped, but maybe I will have to watch it a few times.

https://www.youtube.com/watch?v=yOZK8yr3IKo

Thanks,
Steve

Carmichael

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Re: Disable Array of Objects
« Reply #3 on: October 27, 2017, 01:06:15 AM »
hi, if you look at the array get next action there are two options for loop and finish,

loop gets the next action every time you return back to the state, once you've gone through all the items in the array, the finish event is fired,

so create an event that fires to another state using the loop option, then do what ever you want with the result from the array and then return back to the state with the "array get action". it will automatically loop through and finish.
 the rest depends on your logic

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2265
    • View Profile
    • jinxtergames
Re: Disable Array of Objects
« Reply #4 on: October 27, 2017, 01:13:51 PM »
Hi.

Yes like Carmichael said.

In 'array get next' store your object in a variable and transition to 'Next'
then do what you have to do with the object (variable) ,for example disable/enable
Then transition back to the state with the 'array get next' action.

Once all objects are done it will send the finish transition.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Disable Array of Objects
« Reply #5 on: October 30, 2017, 11:40:55 PM »
Hi,

 I just put up "ArrayActivateGameObjects" on the Eocsystem, this should work for your case.


There is unfortunatly a wrong assumption on ArrayMaker vs FsmArray and perfs/mess, let me clarify this here:

FsmArray is very performant if you don't change the number of items all the times as this is based on a built in array.

ArrayMaker is a lot more performant if you are going to change the number of items in your game loop for example/

ArrayMaker allows you to use Hashtables, to reference value using a key, this is very powerfull and very fast

ArrayMaker allows to mix up variables types in one array or hashtable, this is also very powerful.

So, here I suggest you use the right ways for the task, it doesn't mean that because ArrayMaker is not built in that is less efficient, it has its use cases for sure.

 Bye,

Jean