playMaker

Author Topic: ArrayMaker is now available [April 2021]  (Read 176962 times)

bkups2003

  • Playmaker Newbie
  • *
  • Posts: 49
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #105 on: September 15, 2013, 08:58:28 AM »
Hi,

I couldn't download the beta because of some problems accessing some websites but i just checked the asset store and noticed the new Playmaker is out. Just updated and like you said, the problem is all gone. Thanks so much for all the support. You really helped me through this problem and i'm so happy to be able to continue with my work.

Thanks again.

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #106 on: September 21, 2013, 09:48:44 AM »
So, I have a little problem with ArrayMaker, a Prefab and Parenting.

Here is what I am trying to do:
For a 2D Game we made a Menu, a nice 2D-Book. When the Character gets a Quest, a new Page should be visible with Information and so on. So, the idea was to have an ArrayList which contains these Pages, and everytime the Player gets a new Quest a new GameObject-Item is added to the list. When that happens a new Page is created from the Page-Prefab-Object and parented to a certain Object in my GUI.

I'm testing this right now with a little Box (a future NPC :P ) which triggers an Event on Collision and sends the "NEWQUEST"-Event to the FSM which manages the ArrayList and the Creation of the Pages.


The Scene-Structure of the GameObjects:


The FSM has got one GameObject-Variable:


The ArrayList has no prefilled Items:



In the very first state I check if there is already an Item in the Array with the "Contains"-Method:



If it's false, I'm creating an Object (choosing the Prefab "Page" and storing the Object into the GameObject-Variable)


Then I add the Item to the ArrayList:


Find the Object:


And then I set the parent:



IF the Player rans into the box again, of course the "Contains"-Method is checking again, and this time it will say it's true, since an Item was added to the ArrayList before. There I do almost the same but FIRST I do add the Item to the List and THEN I create a Page from Prefab, find and parent it.

So, what's the problem? The parenting. The first time it works just fine:


But after that it doesn't parent the object anymore. It just creates them in the Scene:


It's adding the items into the ArrayList, but does not parent them.

Where's my mistake? :)

!EDIT:!

I also noticed something. Seems like a bug to me:

- when attaching an ArrayList-Component to an Object and not filling it with Items (leaving the Prefilled Count at 0) and the game plays, it is not prefilled, but as soon you modify that Value and set it back to 0 as soon as you hit play it is prefilled EVERYTIME!
I think this is not intended...


!EDIT2:!

Made some tests with no ArrayList. OnTrigger I create the Prefab-Object and Parent it. The First time it's okay, but then it just creates in the scene, and not as a child of the selected GameObject.







It's definitely a problem with Parenting and not my Array-Structure. The Prefab is tagged with "GUIPAGE" and of course all the created Instances are also tagged with "GUIPAGE". Is this a problem? It seems it can't find the Object with its tag after the first creation again...also using the Name of the Object ("Page(Clone)") does not work.
« Last Edit: September 21, 2013, 12:28:28 PM by Mayhem »

bkups2003

  • Playmaker Newbie
  • *
  • Posts: 49
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #107 on: September 22, 2013, 08:17:07 AM »
Delete "find with tag". The last gameobject that was added is already stored in the variable. Although you added it to the array, the variable still contains that gameobject that was just added. "find with tag" stores one of the instances with that tag but you have no control over which one it finds. My assumption is that it keeps finding the first one again and again and setting its parent to the same object again and again so it looks as if it just did it once for that one object.

If i understand correctly, that's your problem.

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #108 on: September 22, 2013, 11:01:55 AM »
Yes, thank you, that did the job :D

Though, the problem for the Display of the Prefilled Items which I mentioned above still occurs. Seems to be an ArrayMaker-Issue itself.

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #109 on: September 22, 2013, 05:20:57 PM »
So I'm trying to build a system in where if a new object is placed on the map, the characters will move out of the way. To do this, I have an array of game objects on the map, an array of valid squares (Int 0 - Blocked, Int 1 - Open), and an array of all Vector 3 coordinates on the map (0,0,0, 0, 0, 1) etc.

I'm trying to find a way to find the closest Vector 3 to my characters position, so that I can use that Index ID to properly find a nearby open position to tell them to move to. However, the only action seems to be "Find by Game Object" and nothing related to position.

In my FSM, I have my characters position, object position, but can't seem to find any action like "Find Index by Closet Vector 3"

Any thoughs how to accomplish this?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #110 on: September 23, 2013, 01:17:48 AM »
Hi,

 Uhm, I'll look into this. Thanks for reporting.

bye,

Jean

Yes, thank you, that did the job :D

Though, the problem for the Display of the Prefilled Items which I mentioned above still occurs. Seems to be an ArrayMaker-Issue itself.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #111 on: September 23, 2013, 01:19:11 AM »
If i understand correctly, that's your problem.

Thanks for spotting this and helping out on arraymaker questions, I would not have found it myself!

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #112 on: September 23, 2013, 01:34:00 AM »
In my FSM, I have my characters position, object position, but can't seem to find any action like "Find Index by Closet Vector 3"

Any thoughs how to accomplish this?

Hi,

 In the arrayMaker samples, you have a "distance sorting" scene. It's not really a single action, but rather a process. I actually sort the whole list, you may not want that, but that would give you a starting point.

I agree tho, a custom action to do that would be good. Added on my todos... :P

bye,

 Jean

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #113 on: September 23, 2013, 04:17:19 PM »
I'm getting a ton of use out of Arraymaker--thanks so much for providing it!  :)

I have a feature request: can you show hashtable contents in some kind of sort order in the inspector? It could be alpha-numeric by key, or it could be in the order in which they were added to the hashtable.

I'm using a hashtable to store the contents of a random dungeon generator. It stores each wall name as the key, and the contents as the data for that key. When I look in the inspector to try to troubleshoot errors, however, I see something like this:

1_40
23_6
14_8
32_5

instead of:

1_1
1_2
1_3

The funny thing is that the hash table entries were CREATED in the order above--so they're getting randomized in some fashion when they're displayed in the inspector.

It's even worse when I have multiple keys of related data. That means entries that could show up like this:

1_1_SizeX
1_1_SizeY

instead have those two entries scattered sometimes hundreds of entries apart. Once again, this happens even though those two entries were added to the hashtable consecutively. It makes it really hard to debug large hashtables.

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #114 on: September 24, 2013, 06:04:29 AM »
Hi,

 Yep, I am very much aware of this, and I have no solution to this currently. Hashtable are not sorted, it's not meant to be sorted, and I am not sure what to do to overcome this. I may have to add an abstraction layer and maybe provide some sorting features.

bye,

 Jean

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #115 on: October 06, 2013, 08:44:18 PM »
When using the "Array List Create" option, how do you define the variable type (INT, GO, STRING, etc) that the list will contain? I'm trying to dynamically create an array, add some GO's to it, then remove it when I no longer need it. Right now I have the array creating, but it error's out whenever I try to add anything to it since the type is undefined.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #116 on: October 07, 2013, 02:43:10 AM »
Hi,

 What error does it throw and what object are you trying to add?

ArraList are flexible, ANY type can go in, currently the custom action allows you to add the available types from Fsm variables, but that's only the context that restricts to these types. What Fsm variables are you trying to add?

Also, you can mix types within arraylist, you are not restricted to one type per array.

bye,

 Jean

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #117 on: October 17, 2013, 08:22:46 AM »
Hey there.

So I'm trying to get something to work, but I miss something, I guess.

So here is what I want to do:

- I have an ArrayListProxy with Bool-Types which are add dynamicaly by other Objects trough FSMs
- another FSM has the task to count the Bools in the ArrayList
- only 1 Bool-Value is set to TRUE at a time

Another FSM searches for that certain True-Bool-Item in the ArrayList and there's the problem. I can't figure out how I can exactly do that. I need to check the value while looping AND need to get the position/index of that bool-value. Can't figure out how to achieve this.

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #118 on: October 18, 2013, 07:39:17 AM »
Any ideas on this?

parallel

  • Full Member
  • ***
  • Posts: 155
Re: ArrayMaker is now available [JUNE 2013 NEW VERSION]
« Reply #119 on: October 21, 2013, 10:25:12 PM »
If the guy who does the official Playmaker video tutorials were to do a set on arraymaker I would be SO happy. He has a way of making easily understandable examples with interesting narration for non programmers. I must say that this thread and the example scenes hasn't really made it clear to me how it is used, I'm dense like that, and sometimes get it the best from watching other people build something step by step.