How to get access to other charatcer's?

i always get a reference to my character with GetPlayerCharacter but how do I get access to other characters?

I’m assuming you’re talking about non-player characters. In that case, you have a few options, depending on the scenario:

  • If you’re trying to get a reference to a character you’re interacting with, you probably could use traces/overlap events.
  • If it’s an abstract character anywhere in the world, but the character has a specific, hard-coded purpose, you could use tags and use the Get Actors with Tag node.
  • If you want to get a reference to all characters, you could use GetAllActorsOfClass (but it’s expensive)
  • If you want a reference to a character that is chosen by various properties in the code, I suppose you could use GetAllActorsOfClass and loop through to sort (but only as a last resort).

Hope this helps!

1 Like

You could use an array, and then work with it in the level blueprint or something. That would allow you to make a system like FF7 Remake.

i’ve been using get actor of class so far but since they are expensive to use im looking for a better way.

the character is an ai which is patrolling around and the ai is not supposed to interact with anything. is there seriously no other way to get a reference to it other than using get actor of class?

You could store a reference in the Level Blueprint, but that could be hard to obtain.
Another way to do it would be to have a variable in the Blueprint that wants the reference of the type of actor you want from the world. Then, after clicking the eye button in the variables section, you could set the Actor in the editor. This is the best way if it’s a preset reference to an Actor already in the level that you won’t change at runtime.