playMaker

Author Topic: send event if several FSM are activated [SOLVED]  (Read 162 times)

yyup

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
send event if several FSM are activated [SOLVED]
« on: March 05, 2021, 06:13:12 AM »
I want to send an event if I clicked on several objects in the game world not in any specific order, so I added and FSM on each one that has a mouse pick event that change their material, and when they all change, I want to play a movie on a plane for example, how do I go about doing it? 
« Last Edit: March 08, 2021, 06:08:00 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3893
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: send event if several FSM are activated
« Reply #1 on: March 07, 2021, 12:56:10 AM »
One way to do this is keep a count of clicked FSMs that goes up by one when an FSM is activated. When the count reaches the required number you can play the movie (or whatever).

There are a few ways to implement the counter. You could have a Counter FSM that keeps the count, and receives activated events. The activated FSMs either broadcast this event or send it to the Counter FSM. With each activated event the count goes up by one. If FSMs can de-activated, you could send a deactivated event and the count goes down by one. So the count always matches the number of FSMs activated.

Does that make sense?

yyup

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: send event if several FSM are activated
« Reply #2 on: March 07, 2021, 04:11:43 AM »
thanks for the reply, what actions do I need to put in that counter FSM, I'm assuming a count Int var and and an add int each time the button is clicked? also is there a way to make the mouse button click once? like the Once unit in bolt or the Do Once in UE4?

yyup

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: send event if several FSM are activated
« Reply #3 on: March 07, 2021, 04:41:00 AM »
the way I'm doing it is like this but the and I made this FSM on an object level and copied 4 of them, the timer below is set to wait 4 seconds if nothing is clicked then a game over pops up, the issue I'm having is that since start isn't on the compare it keeps clicking and adding to the int var (counter) and I want to click on each object once

https://imgur.com/a/NUpvQSh

yyup

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: send event if several FSM are activated
« Reply #4 on: March 07, 2021, 04:49:16 AM »
Actually never mind I realized that I was being dumb, it was very simple

thanks

https://imgur.com/a/JQHERCx

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3893
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: send event if several FSM are activated [SOLVED]
« Reply #5 on: March 08, 2021, 06:08:21 PM »
Looks good :)