playMaker

Author Topic: Iterate hash table - get bool - how to deactivate an object?  (Read 1223 times)

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Hi,
I've stuck in 'Hash table get next' for 2 days and really hoping to get some help...
I want to test the objects' bool value through hashtable and disable some if their bool is false.
Now I have the problem to match the picked/current bool value to the individual object and deactivate it.
Looking forward to hear some advise.

Thanks!
M

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Iterate hash table - get bool - how to deactivate an object?
« Reply #1 on: May 31, 2018, 06:39:29 AM »
Hi,

 what does the key for your hashtable represent? if should be the name of the gameobject or an id which you can then use to find a gameobject no?

 the other solution is two arrayList, one with gameobjects, and one with bools.

then you get the index of a gameobject, and check on the second array the bool valud at the index and you can then act on that gameobject.

 Bye,

 Jean
 Bye,

 Jean

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Iterate hash table - get bool - how to deactivate an object?
« Reply #2 on: May 31, 2018, 10:07:39 PM »
Hi Jean,

Thanks for your advice.
I have figured out a solution which seems close to what you suggested.
It includes the 'hash table set' action to connect the two hash table (Please see attachment).
It generally works to deactivate the objects with 'false' value, but I'm still facing some problems:

1. It takes too long to complete the actions that when it loads the scene, I can see it deactivates the not wanted characters. But what I want is for only one actor standing in the scene without showing the 'deactivating others' action.

2. how can set the bool values in menu scene and send it to game scene (I dont want to use the same array manager in menu scene and game scene and my characters are not prefab). The current controller is in game scene and all the characters bool value is false.

Could you please give more advise?

Thanks
M






jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Iterate hash table - get bool - how to deactivate an object?
« Reply #3 on: June 01, 2018, 02:23:52 AM »
Hi,

1. then you have a problem of logic. If it takes too long, you also may have a problem of what you are activating, the logic you have in your fsm is unlikely the source of the time it takes to process but rather the gameobject you are activating have components that take time to setup

to verify this, don't activate or deactivate but just output logs in the console and debug first like that, making sure the log matches your expectations and the values in the tables. then move on and actually activate deactivate, you'll narrow down the source of your problem quicker this way.


2: make your object to not be destroy on scene load, and then it will always be there. You should also make it as a singleton, so that you don't end up with duplicates should you go back to the menu.

Bye,

 Jean