playMaker

Author Topic: Easy way of sending events/changing properties of lots of scene objects?  (Read 2931 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
I'm not really sure the best way of doing this, that will eliminate manually maintaining events or links.

  • So I have (in my dk forge level select) a buttons panel that has 100 child objects, buttons to load my levels.

    I have 100 global ints to identify whether a level is locked/unlocked (0=locked, 1=unlocked).

I want to set a property within each button so I can make it disabled, based on the corresponding bool.

I'd rather not have an FSM on each object that I manually change the Bool Test action on (especially as I may want to delete these buttons and redo them later), so I was thinking about having an empty object in my scene that checks each global int and fires an event to each individual button, or sets property.

Any ideas on the easiest way of doing this?


« Last Edit: May 13, 2014, 04:45:07 PM by jess84 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Hmm.. I would first try to go for some tricks with hierarchy/children/arrays and avoid the buttons themselves having to actually do anything.

I'm thinking something like storing the buttons all as children and naming them the same as the bool variables they correspond to, then looping through them and firing a pass/fail event on each one to do Something depending on if they're locked/unlocked (such as activate/deactivate the button or change it to a locked icon).

Using arraymaker this should be possible, corresponding the bool/gameobject names is what im not so keen on, off the top of my head.

I'll look into it a bit and try to make an example if this doesn't really stimulate any ideas for you.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Thanks for that.

I went over various ideas using Arraymaker, but my skills aren't really good enough and it came to nothing, even when I thought I was on the right track  :-\

Btw, I edited my original post, as I realised I was using ints for this, not bools.

My buttons are name 'Button_001" etc, and I'm using Get Name to do other things (using the last 3 digits, for building strings and choosing what level to load etc. I'm now thinking about using 1 FSM template and doing an Int Switch  - checking the object name value to send to another action which then Int Compares for that global int - and if there's a match, set the dkforge property.

It'll probably take an hour or so to set up manually, then make sure I have the template created on each button I create in the future.

Do you think an array solution would be less hassle?
« Last Edit: May 13, 2014, 05:40:18 PM by jess84 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
I've done similar stuff so there is a way to do it without an fsm on the buttons. But if I had a way working in 30 minutes I might debate looking into a more elaborate system.

If it's ints and levels are unlocked linear then just activate the buttons corresponding to the int and child number. That's fairly simple to do with a loop.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
How would I do that with a loop?

(My array knowledge is pretty limited)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
See attached.

Its just doing a loop with get next child for the count of the unlocked levels until it runs out of int values. This is resetting a rotation, but you could for instance remove the wait action and send your dfgui event in the loop or whatever.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jess84

  • Hero Member
  • *****
  • Posts: 515
Thanks for that!

I've almost finished doing my Int switch/Int compare method, which I think is pretty robust - and should work fine when copying & pasting buttons for new ones.

Your example has however shown me a useful trick - I already know where that's going to come in handy on my project :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Cool, glad it helped!  :)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D