So I’ve got a map where there are multiple teleportation systems by means of pressing E when the actor is within a certain trigger box.
My problem is that I have lots and lots of these and am assuming that there is some way to condense it but I cannot figure out how.
Above are two of my sequences and you can see the similarities. The only differences are the events triggering them, which only differ by the trigger box they are derived from, and then the location the actor is teleported to.
I would make use of Macros. They can take both execution pins and variables as inputs and will simplify things quite a bit i think. Hope it helps.
Or you could create you own overlap detection object, that way you can add any number of properties in the inspector. Add a vector property ( check “Show 3D widget” to make it cooler ) representing the location you want to teleport to and move the user there on “E” press.
First, I would take the logic out of the level blueprint and put it into an actor. Level blueprints are really just for level specific functionality that won’t need to be expanded to other level or repeated. Make it modular so you implement it once and reuse it by creating a new teleportActor and implementing everything inside it. Then you just drag as many in as you need teleporters, etc.
The teleportActor can have a target property that is set to point at an instance of an actor in the level or set to a location in level. After you drag it into the level you just set the public property on the instance.
Triggering it could go different ways. Either:
- The Character/Pawn handles E and checks if he is overlapping a teleporter. If he is, then he calls a function on the teleporter to move him.
- Or the teleporters all handle E and each one does a check every time. Less efficient perhaps but depending on scope not a big deal.