playMaker

Author Topic: BROADCAST ALL question [solved!]  (Read 3024 times)

Tonda

  • Playmaker Newbie
  • *
  • Posts: 31
BROADCAST ALL question [solved!]
« on: February 19, 2016, 07:50:37 PM »
Let's say I have 50 identical prefabs that were created during the scene all listening for a global trigger.

How could I set it up to BROADCAST the global event to just 5 of them (random)?
« Last Edit: February 23, 2016, 05:07:17 AM by Tonda »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: BROADCAST ALL question
« Reply #1 on: February 19, 2016, 09:10:40 PM »
Just one idea- there's an action to send events to objects of a certain tag or layer- its on Ecosystem "Send event to tag"- you could randomize their tags on each run- then send event to all objects of a tag type-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Tonda

  • Playmaker Newbie
  • *
  • Posts: 31
Re: BROADCAST ALL question
« Reply #2 on: February 19, 2016, 09:13:38 PM »
Cool idea! I def. think that has merit and Im going to grab that off ecosystem.

For this particular problem, I need an exact number of triggers. It seems the tag randomization would make it so that a random number (10% for instance) of the precomps will fire but not exactly 5 (If im understanding your method correctly.)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: BROADCAST ALL question
« Reply #3 on: February 20, 2016, 05:57:32 PM »
Hi,
i might have a solution for you by using an array list
try if this sample works.

i had to build this quick so i am not sure if it is exported right.
if not let me know and i will try to make a video tomorrow and re-upload the sample.

Tonda

  • Playmaker Newbie
  • *
  • Posts: 31
Re: BROADCAST ALL question
« Reply #4 on: February 20, 2016, 11:11:57 PM »
Oooh, thanks a ton for compiling this, I'll try it out, I need to grab some stuff off ecosystem for it. will report back!


edit: I got hung up at State 5 (Array List Remove At) with the error "Less than 0 or more than list count. Parameter Name: Index" , trying to troubleshoot now
« Last Edit: February 20, 2016, 11:20:38 PM by Tonda »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: BROADCAST ALL question
« Reply #5 on: February 21, 2016, 08:57:14 AM »
Hi,
is this in my sample or in your own project?
if you have no wait in you setup you might try adding a state before state 5 and put the "next frame Event" Action.
i will make a video today and i will also update my sample :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: BROADCAST ALL question
« Reply #6 on: February 21, 2016, 02:10:10 PM »
Hi,
i made a video and an updated sample,
check it out here