Hi! I’m working on a game for a class project. I’m new to C++ and Unreal Engine, and I’ve been doing fine so far using tutorials, but now I’ve run into something that’s stumped me.
I’ve been using the following information to attempt to make a multiplayer where two players can use the same keyboard (one with WASD, one with arrow keys).
There’s a bit of code that isn’t working so far, though:
int32 id = GetLocalPlayer()->GetControllerId();
The compiler doesn’t appear to recognize GetLocalPlayer(), and when I try other things, I get a “nonstatic member function must be relative to a specific object” error, and when I make it relative to a specific object it isn’t an int32 and I get an error in the next line. I’ve looked at everything on google that’s even remotely related but none of the solutions seem to apply (or if they do apply, they’re above my current level of understanding and not specific enough for me to know how to implement them).
The one problem I can think of is that I’ve included Engine.h in my Avatar class rather than “the main header file” as the tutorial recommends, but I have no idea what it’s referring to with regards to the main header file, I wasn’t able to find an answer on google, and I wasn’t able to find the “EngineMinimal.h” I was supposed to replace anywhere in the project.
Is there a simple solution to this problem, or should I find a different way to implement local multiplayer on one keyboard? Using gamepads isn’t an option.
I really appreciate any help – it won’t affect my grade if I can’t figure out this multiplayer, but I think it’s essential to the game and I’m determined to figure it out if it’s the last thing I do. Thank you!