playMaker

Author Topic: Is there an action to iterate through a list of gameobjects?  (Read 6003 times)

markinjapan

  • Full Member
  • ***
  • Posts: 103
Is there an action to iterate through a list of gameobjects?
« on: September 02, 2012, 09:25:01 AM »
I want to define an array of x amount of gameobjects and then loop through them, wondering if there was an action that did this?

Something like the 'Select Random Gameobject' action but sequential.

I'm thinking that maybe ArrayMaker might have something like this but I think it would be useful to have this kind of thing within the standard Playmaker actions.

Would tidy up a lot of my FSMs :)

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there an action to iterate through a list of gameobjects?
« Reply #1 on: September 03, 2012, 05:00:34 AM »
Hi,

 Yes, ArrayMaker has this ability, as for selected random GameObject within an array, do you expect to not select the same one again? like picking cards out of a deck?

bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Is there an action to iterate through a list of gameobjects?
« Reply #2 on: September 05, 2012, 05:23:53 PM »
Yes, That that's correct, it would only be used once, if the user wanted to use again they could loop the action. And also sequence them (just in order top to bottom) would be perfect.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there an action to iterate through a list of gameobjects?
« Reply #3 on: September 05, 2012, 06:06:05 PM »
Hi,

 I can't find it, but I think I had this discussion before on this forum.

 basically, one way of doing this is the following:

 Have a temporary arrayList ( a copy of your actual list) and pick a random one in it, AND delete it, then pick a random one again, etc etc etc. This would be the best approach I would say,

 Have you tried that?

bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Is there an action to iterate through a list of gameobjects?
« Reply #4 on: September 08, 2012, 04:23:52 PM »
This is the action I mean.

https://hutonggames.fogbugz.com/default.asp?W442

So where it says 'weight', that would be 'order'.

When this action was called it would get the 1st gameobject in the order and pass it to the next action, the next action would then loop back and then the 2nd gameobject would be called and so on. It's the sequencing that's important.

I guess this should be done in an array (and I really need to get my head around arraymaker...) but for really small lists (of gameobjects) this would be really handy :)

Mark

Hi,

 I can't find it, but I think I had this discussion before on this forum.

 basically, one way of doing this is the following:

 Have a temporary arrayList ( a copy of your actual list) and pick a random one in it, AND delete it, then pick a random one again, etc etc etc. This would be the best approach I would say,

 Have you tried that?

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there an action to iterate through a list of gameobjects?
« Reply #5 on: September 10, 2012, 03:30:16 AM »
Hi,

 I don't think this is the action you need, as it will pick randomly in that list of gameObject, even if you put weight, The solution of using arrayMaker and a second list acting as a pool to select gameObjects is likely the right way to do it,

 Have you tried to mess around with arrayMaker already?
bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Is there an action to iterate through a list of gameobjects?
« Reply #6 on: September 11, 2012, 03:20:17 AM »
Hi,

In truth, not much, I guess I should as arrays are really useful.

If there were video tutorials it would make learning arraymaker a lot quicker ;)

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there an action to iterate through a list of gameobjects?
« Reply #7 on: September 11, 2012, 05:34:43 AM »
Hi,

 Unfortunatly, no screencast on arrayMaker... but given the demand, I really need to get down with this,

bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Is there an action to iterate through a list of gameobjects?
« Reply #8 on: September 15, 2012, 06:12:04 PM »
True, I think it would be great if whoever is doing the Hutong games youtube videos could do a few tutorials. He's doing a great job so far, I've learnt a lot.