Download

Referencing all triggers?

Is there a quick way of referencing all triggers within a level?

I’d like to move all the triggers in my level to a certain height on keypress, but I can’t seem to find a way to do this?

You mean Trigger Volumes?
Yes there is node “get all actors of class” it makes an array

But if i guessed correctly what you want to do, there is better way:

  • create an actor, add collision box to it as component.
  • create event dispatcher in one of those bps: gameMode gameState or playerPawn (or character). Best for testing is in player character, all code in one place.
  • from actor that you created assign event to dispatcher in player character (or other bp i mentioned)
    Then call that event dispatcher in player character, all actors will be notified, then they can move their trigger box to same level.

Hi Nawrot,

I’m using box triggers, the problem is there’s hundreds of them in my level and I need to move them down when the player gets to a point in the game and I need something that’ll work with that setup so I don’t have to redo each trigger?

I’d really appreciate some help

Place triggers inside actor blueprint, setup it there.

make parent of all trigger actors, put all trigger code there.
if you can group triggers by some set of values, do single child of parent for each group. And set default values for that group inside that child actor.

Then place those actors in level and tweak final differences between them.

When you want something from trigger actor cast to parent of all trigger actors…

You also can make function that checks if trigger should be on or off depending on player position in game. Each trigger can disable\enable self.

OR you make enumerator that is name of group of triggers. THen you make event dispatcher in player. Then each trigger actor hooks to that dispatcher. Then you dispatch events about turning on\off for groups of triggers.

is there a way without altering the triggers, ie by using a get all actors of class?

GetAllActors of Class works with triggers. Then you get trigger actor location, change Z value and apply back.

Awesome thanks!