Generic trigger

Hello!

I want a trigger BP to trigger a lot of different assets with different behaviors in a level, for instance changing a light or height fog intensity or color with specific values, or simply trigger an animation, so I can use one BP in multiple scenarios. So far I’m going with blueprint interface to pass event/values from the trigger BP to another asset BP, referencing the level asset in the trigger’s public actor ref.

Question 1 : is it viable to try doing everything with one trigger BP ?

Question 2 : if yes, there’ll be a lot of parameters available in the trigger. Is there a way to order them properly in the interface ? For instance ticking a box first to enable a param, and maybe create a visual interface structure, like what can be found inside a post process actor for instance

Thanks

what you say sounds like Event Dispatchers…you make a ‘call’ and all listeners react with some binded event/function

you can also make dispatchers with a signature function and pass parameters

image

image

image

then put the signature in the dispatcher

image

done

image

create a matching event

image

1 Like

Thanks for the detailed answer. I can already do what I need with bp interface, and I’ll look further into event dispatchers on my side, but can you tell me what’s the added value to do it that way instead ?

with interfaces you have to ‘interface’ actor by actor. a dispatcher you just make the call ONCE and ALL the listening actors (the binded ones) will react

ALL the listening actors (the binded ones) will react

isn’t it an issue though if I want one trigger bp instance to affect one specific light bp instance, and not this other light bp instance that’s also in the level ?

your title says generic trigger…is confusing…if you want to make one call for a lot of objects the same time you can use a dispatcher…each listening class will have its own event or functions with his functionality. if you want to affect one specific actor then just go for interfaces or casting

generic in the way that the trigger can be used for different actions, If that’s clearer. So I’m reassured I’m going for the right solution so far (with interface bp). My initial questions are still open :slight_smile:

event dispatcher doesn’t have to call many at once, it’s just a form of communication in which the calling object doesn’t need any reference. Avoiding cross references is its greatest strength

I use a generic trigger too

Then you can unbid just that bind or you could unbind all, depending on the case.

I do need to reference an actor though, as that’s what will make the trigger bp trigger only what I want it to trigger, right ?

yes, trigger no ammo is the reference to the Ld_triggerBase.

Here I use the trigger for something completely different and I put the reference from the map.

alright, then what’s the gain to use event dispatchers instead of bpi in the situations I described at the begining ?

from what I’ve seen so far for event dispatchers, they seem to be used for linking BP that doesn’t exist in the world, hence creating systemic behaviors.

Aren’t bpi more suited to level based situational actions ?

In both cases I’d like to bump my initial questions as well, as I believe they’re relevant to both solutions

I don’t have an answer for the question, could it be done with BP?

What you do gain is more modularity and granularity, the job of the trigger actor is to warn that it has been crossed, but not what actions to do, if every time you need something new you add more variables to the trigger list, that can be gigantic and unruly.
I think it is better to leave the trigger as agnostic as possible and create the logics in other more dedicated bps, one for light, another for sound, etc.
Of course it all depends on the complexity of the game.