playMaker

Author Topic: I have Hundreds items on my game and can't create an array list for each one!!!  (Read 1966 times)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
I have an array list that has 10 game objects and all my items must use those game objects positions.

The problem is that I can't create that array list for Hundreds items. because if I'm going to change any of those GameObject in the future I should change all my hundreds items and that is impossible.

« Last Edit: June 17, 2018, 06:44:45 PM by Silicon Power »

jeanfabre

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

why not? I made tests and you have 1000's of items in your list, it will be fine. what matters is what these 1000's items are and what they will do if they are gameobjects with logic.

your array should be filled using logic and not manually, that's probably where you are getting stuck.

 could you describe what they are, right now your explanation is to generic to be able to propose a real case for usage.

 Bye,

 Jean

Silicon Power

  • Full Member
  • ***
  • Posts: 186

Quote
So the problem is "Get Fsm Array" doesn't work correctly.

Hi,

 what is wrong with GetFsmArray?

and yes, I think your best bet is to us ArrayMaker and make an hashtable or ArrayList on a dedicated GameObject that any fsm can access, your data is then external to Fsms, and you just get the placeholder you need for each logic flow.

 Bye,

 Jean
« Last Edit: June 21, 2018, 02:15:38 AM by jeanfabre »

GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Here is a method that I used for character customization:

Setup an array or hash table that corresponds to the area you are changing.
EG. HeadItems - array, LeftHand -array.
Put all the gameobjects that need to go in that spot into the proper array.

Then I set the following as global variables: (probably not the best method, but one I personally found most consistent). I use all caps for Globals.
PLAYER_OBJECT - As GameObject
HELMET_ITEM - As String

To set and change the equipment: using a helmet as an example
Local FSM Variables needed
Gameobject - NewHelmetObject
Gameobject - OldHelmetObject
GameObject - HeadMountPoint
GameObject - ArrayResult
Int - IndexID
String - CurrentHelmet_String
String - array/hash table reference (optional)
String - Child mount point location (optional)

State1:
Load key to fill CurrentHelmet_String (Easy Save preferred). Default is blank
Holder state that is fired off from a send event -  eg. Change_Helmet

State2: check for valid object
Array List contains game object:
Check HELMET_ITEM string to see if array list contains the object
Game Object: Owner or Specify Game Object
Reference: HeadItems
Game Object Name: HELMET_ITEM
Result: ArrayResult
Result Index: IndexID
If true go to State3 - change
If False go to state5 - default catch

State3: Create and place new object from array/Hash table
Array List get: Get your object from the array. store as NewHemletObject.
Find Child:
     GameObject: PLAYER_OBJECT 
     Child Name: (eg) Player/Head/Hat/MountPoint
     Store Result: HeadMountPoint
Create Object Advanced (ecosystem):
     GameObject: NewHelmetObject
     Parent: HeadMountPoint
     Set Active: Check
     Store Object:  OldHelmetObject (important so you can destroy old hat if equipped)
String compare: HELMET_ITEM to CurrentHelmet_String. If not matching fire event to move to State4

State4: Destroy item and reset
Set String Value: CurrentHelmet_String to HELMET_ITEM
Save: CurrentHelmet_String (Easy Save)
Destroy object: OldHelmetObject
FINISHED Event points back to State2

State5: Set to default
Set String CurrentHelemt_String: Set this string to a default object in your array - array item can be empty (none)
Set String HELMET_ITEM string: Set to same name as above
FINISHED Event - Go to State2

I am looking forward to what others may have done as well.
Always up for learning :)



« Last Edit: June 18, 2018, 09:56:49 AM by GonerGames »

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Here is a method that I used for character customization:

Setup an array or hash table that corresponds to the area you are changing.
EG. HeadItems - array, LeftHand -array.
Put all the gameobjects that need to go in that spot into the proper array.

Then I set the following as global variables: (probably not the best method, but one I personally found most consistent). I use all caps for Globals.
PLAYER_OBJECT - As GameObject
HELMET_ITEM - As String

To set and change the equipment: using a helmet as an example
Local FSM Variables needed
Gameobject - NewHelmetObject
Gameobject - OldHelmetObject
GameObject - HeadMountPoint
GameObject - ArrayResult
Int - IndexID
String - CurrentHelmet_String
String - array/hash table reference (optional)
String - Child mount point location (optional)

State1:
Load key to fill CurrentHelmet_String (Easy Save preferred). Default is blank
Holder state that is fired off from a send event -  eg. Change_Helmet

State2: check for valid object
Array List contains game object:
Check HELMET_ITEM string to see if array list contains the object
Game Object: Owner or Specify Game Object
Reference: HeadItems
Game Object Name: HELMET_ITEM
Result: ArrayResult
Result Index: IndexID
If true go to State3 - change
If False go to state5 - default catch

State3: Create and place new object from array/Hash table
Array List get: Get your object from the array. store as NewHemletObject.
Find Child:
     GameObject: PLAYER_OBJECT 
     Child Name: (eg) Player/Head/Hat/MountPoint
     Store Result: HeadMountPoint
Create Object Advanced (ecosystem):
     GameObject: NewHelmetObject
     Parent: HeadMountPoint
     Set Active: Check
     Store Object:  OldHelmetObject (important so you can destroy old hat if equipped)
String compare: HELMET_ITEM to CurrentHelmet_String. If not matching fire event to move to State4

State4: Destroy item and reset
Set String Value: CurrentHelmet_String to HELMET_ITEM
Save: CurrentHelmet_String (Easy Save)
Destroy object: OldHelmetObject
FINISHED Event points back to State2

State5: Set to default
Set String CurrentHelemt_String: Set this string to a default object in your array - array item can be empty (none)
Set String HELMET_ITEM string: Set to same name as above
FINISHED Event - Go to State2

I am looking forward to what others may have done as well.
Always up for learning :)

Thanks but everyone has his own method I can't leanr much about you method. The only thing I need is to access array variable from another Fsm.
« Last Edit: June 18, 2018, 03:59:31 PM by Silicon Power »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
Maybe you should use array maker, it uses a component with a reference as array.
Which you can easily work with from any fsm/gameobject.


You can get array maker on the Ecosystem

And here is a tutorial :