How can I get parameter of the Character in a different file .cpp?

I need get Relative Location of my character in different cpp file (not Character.h or Character.cpp). How i can do this?
For example:

AFPGCharacter::capsule_component->SetRelativeLocation(0.f, 0.f, 0.f);

What file are you wanting to get that in?

That’s not how code works, in C++.

Code just defines the structure of an object, the object has to be instantiated to be used. Once the object is instantiated (e.g., created, spawned, static allocated, whatever) - you have to get that Object from the system to access properties on that Object. You can use things like a TActorIterator or something like that to find your object.

// Assuming this code is called in some UObject which has access to the GetWorld() method.
for(TActorIteractor<AFPGCharacter> It(GetWorld()); It; ++It) // Find every AFPGCharacter in the current World.
  if (AFPGCharacter* MyCharacter = *It)
     MyCharacter->CapsuleComponent->SetRelativeLocation(0.0f, 0.0f, 0.0f); // Access this Character Object, Access the Capsule Component member, and set the RelativeLocation on that component.

That’s not the only (or best) way to find the object. It’s just an example. There’s a thousand ways you could find that object - it just depends on the situation.

If you’re new to C++, or coding in general, I’d take a look at some of the various tutorials online. Supposedly the UDemy course is pretty good: Unreal Engine 4 Course (Create Multiplayer Games with C++) | Udemy

It’s not working.

They are depreciating pawns Iteractor. Try getting the controller then the pawn from it. Have not tested but should work.

for (TActorIteractor<AFPGController> It(GetWorld()->GetControllerIterator()); It; ++It) // Find every AFPGController in the current World.
     if(It.GetPawn())// Find a AFPGCharacter in the current World.
         It.GetPawn()->CapsuleComponent->SetRelativeLocation(0.0f, 0.0f, 0.0f); // Access this Character Object, Access the Capsule Component member, and set the RelativeLocation on that           component.

Its that portal actually in the world? Did you try stepping through? Copy and pasting my code without understanding it isn’t going to get you anywhere.

It would be a lot easier and faster if you were more specific or perhaps a better explanation of what you’re trying to achieve.

What exactly are you trying to do? You say “get parameter of the Character”, but is it only the player or all characters in the world? You have a portal with a box component, so you want to access the character that overlaps that box or what?

yeah that would help a ton, plus i see you are putting that into a tick function? why would you want to resize the capsule on every tick on every character?
Are you wanting to just set it once, then that is it? are you after one character, the one that is in your portal? or all them? answer these questions then we could help you much easier.