Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GridPawn.cpp: State->Grid is NULL when 2 or more players #8

Open
DrScientific opened this issue Jul 10, 2018 · 1 comment
Open

GridPawn.cpp: State->Grid is NULL when 2 or more players #8

DrScientific opened this issue Jul 10, 2018 · 1 comment

Comments

@DrScientific
Copy link

Hi!

I'm attempting to alter the code a bit to make it work for a multiplayer game, but I've been running into this issue when the player count is increased to 2 or more (State->Grid is NULL.) This holds true for the original plugin without any of the edits I've made to it. I'm a bit stumped as to why this error is occurring other than perhaps multiple game states are being made when there is more than one player and one of the states is not being initialized correctly. That seems unlikely though, I would think only one game state is created. Anyway, if you have any idea as to what might be causing this I'd appreciate the input. Thanks!

void AGridPawn::BeginPlay()
{
	Super::BeginPlay();
	auto *State = GetWorld()->GetGameState<ANavGridGameState>();
	check(State && State->Grid);
	Grid = State->Grid;
	SelectedHighlight->SetRelativeLocation(FVector(0, 0, Grid->UIOffset));

	ATurnManager *TM = State->GetTurnManager(TeamID);
	check(TM);
	TM->Register(TurnComponent);

	if (SnapToGrid)
	{
		MovementComponent->SnapToGrid();
	}
}
@larsjsol
Copy link
Owner

I must admin that I have never tested NavGrid with more than one player and I imagine that there are several things that must be fixed in order to make that work.

It will take a few days before I have a chance to look into this. Should you figure something out pull requests are always welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants