Download

UE4 - Just Teleported node not working, why?

Hi, i need my actors to figure out if they have been teleported by themselves (without any other BP telling them or sending them a message) so i used the “just teleported” node, wich detects if there has been a change in location by teleportation, BUT… it doesn´t work, because as soon as the game starts, actors get a first “just teleported” wich i have detected by using a print string, then… i canot use it to auto detect teleportation, because as son as the game starts, they receive a false teleportation message.

What can i do?

How are you checking it?

I had to use a tick, no idea if there is another way really, because i need to detect the exact momento when it happens, i might delay this check just by 1 second, so it constantly has to be checking.

I’m assuming you do not want to use an event for a reason - you do not want to cast? How about an interface, you can fire it at anything and it fails gracefully.

But honestly, why not just have a function in the base class of your *teleportable *entities and call that?

This is why i canot cast or use any event: I had too many issues with spawning enemies, since the spawner creates the AI´s in-game it slows dramatically the fps when it reaches more that 100 enemies or actors also with Niagara FX, so i decided to forget all about spawners and use a different aproach:

I decided to add 100 - 300 hidden duplicates of the same AI BP to the scene, each one has an editable tag, so i named each of the 300 with a different name in their details, all this AI´s are disabled as event begin play starts to avoid other issues, and now my fps is perfect and hardly ever changes since this AI´s are already in the scene, BUT since the only way to difference one AI from the other is by their diferent tags (because they are the same BP, now i need to teleport them from their location to the new location (replacing the spawning efect), this Works like a charm, each AI is teleported perfectly…. my problem is…… that now i have no idea how to enable them back, i canot use an event because this activates all AI´s, same reason why i canot use “get all actors of class”, there has to be something inside the AI to auto detect this teleportation and actívate them fast.

All this AI´s must be teleported, since my game is open world, and i canot have invisible AI´s all over the world…. wich is hudge, it might requeire like 10,000 AIs LOL… its easyer to teleport, and when they die, send them back to slep and call them back later.

I only have about 2 options: I can rather use “just teleported” wich is still not working since all AIs are activated at start because the “just teleport” node creates a false connection when the game starts OR i might add a new tag to the teleported AI´s, and since AI´s use a tick to check if this tag is inside, it can choose to auto actívate, this Works fine, but now it replaces all his tags or 1 with this new tag, and then…. it causes errors in the AI because they also have other tags to work.

I don’t understand, you know which one you’re teleporting - so that’s the instance you want to talk to - fire this instance’s event. This surely must be better than tick-checking 300 actors.

I know… horrible… but i canot create any event, i already tried and as i do, all actors receive the event, but this worked for me:

Instead of using the tick of death…. LOL i added a Box Collision to the teleporter BP, whenever one of this AI is overlaped by the Box Collision in the teleporter (wich is inevitable once teleported), first the AI checks if this overlap comes from the teleporter, if true, it triggers the activation of the AI´s.

Simple solution.