playMaker

Author Topic: All triggers FSM fire together[SOLVED]  (Read 2928 times)

kurai

  • Playmaker Newbie
  • *
  • Posts: 9
All triggers FSM fire together[SOLVED]
« on: October 10, 2016, 11:16:10 AM »
Hi there, for a game I'm making I need some triggers that make different Text meshes appear when you go in certain parts of the level.

So I've create a simple FSM which takes care of making the text appear on the trigger. Then I've made a prefab out of this thing just to have it handy and place multiple instances of it around the level.

Problem is, if I put more than one on the scene, they fire all together when I enter the first trigger.

Is there a way to make it so the trigger event is sent only to the FSM of the trigger I enter?

Attached is a screen showing how it's now.

« Last Edit: October 14, 2016, 02:40:35 AM by jeanfabre »

Kemono

  • Playmaker Newbie
  • *
  • Posts: 11
Re: All triggers FSM fire together
« Reply #1 on: October 10, 2016, 12:37:11 PM »
Try to use the "Collision Event" and store the gameobject,
then use that with "Send Event" and target the hit gameobject, to only send an event to target and not global.

kurai

  • Playmaker Newbie
  • *
  • Posts: 9
Re: All triggers FSM fire together
« Reply #2 on: October 11, 2016, 02:34:39 AM »
Wait, are you telling me that triggers are meant to work like this? That it's impossible to activate just the FSM attached to the (sorry) triggered trigger?
It seems really strange to me.

(And what's more important, collision event is not a trigger event).
« Last Edit: October 11, 2016, 02:38:01 AM by kurai »

Kemono

  • Playmaker Newbie
  • *
  • Posts: 11
Re: All triggers FSM fire together
« Reply #3 on: October 11, 2016, 05:24:44 AM »
Hi,
I skimmed through the post first time around, read it again more carefully.

Anyway, tried to recreate your problem, without success.


script on cloned prefab

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: All triggers FSM fire together
« Reply #4 on: October 11, 2016, 05:25:44 AM »
Hi,

 What action do you have in your start state?

-- These global system events are fired on all fsm where the collider or trigger has been fired.

-- If you want granular control use the related actions "TriggerEvent" or "CollisionEvent", then you can fire your own event for a very specific trigger.

-- you may know about this, but this is meant for everyone: DO NOT SEND system events using actions. Never do that, it's highly misleading. So for example do not send the event "TRIGGER ENTER" from the action "TriggerEvent", or from any actions for that matter.


Bye,

 Jean

 

kurai

  • Playmaker Newbie
  • *
  • Posts: 9
Re: All triggers FSM fire together
« Reply #5 on: October 11, 2016, 10:53:22 AM »
So, on my start state I've got just a set material color which initialises the text color as transparent (taking it from a color variable, the same I use in the other two states to fade in/out the text).

So, ok, the globals are just fire an event whatever trigger has been activated, am I correct?

I tried with "Trigger Event", but it does exactly the same. You enter the first trigger and activate all fade ins in all the prefab. Here is how I did it:



I can't understand how I can fire the event for a specific trigger. For what I'm seeing I can only detect the tag of the object that ENTERED the trigger, but I've got no information on the trigger itself (there is no Owner option).

It really seems a bug to me, it's impossible that trigger events fire all together, that basically makes trigger detection useless, am I right?

Kemono

  • Playmaker Newbie
  • *
  • Posts: 11
Re: All triggers FSM fire together
« Reply #6 on: October 11, 2016, 04:30:38 PM »
The FSM is on the trigger right? Where does the trigger figure out which text to activate?

kurai

  • Playmaker Newbie
  • *
  • Posts: 9
Re: All triggers FSM fire together
« Reply #7 on: October 12, 2016, 02:14:30 AM »
Yes, the FSM is on the trigger, as well as the 3Dtext (it's a single object).
The FSM uses the owner option to change the Text material (could this be the problem? Shouldn't Unity do a copy of the material when you change its colour?)
« Last Edit: October 12, 2016, 02:16:52 AM by kurai »

kurai

  • Playmaker Newbie
  • *
  • Posts: 9
Re: All triggers FSM fire together
« Reply #8 on: October 12, 2016, 02:30:02 AM »
I've solved it!
Kemono gave me the right hint.

What I did before was directly changing the material colour alpha from the fade in/out states. That just changed the material as it was counted as shared between objects.

So I just used Get Material in the first state, put the material in a variable and used that to change the alpha. Now it works! Yay!