Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

possession not working

when i try to possess a pawn that i spawned in my custom game mode, it only works on the listen server and on none of the clients

the clients cameras move over to the spawn but i cant move the camera or the pawn. on the listen server it replicates correctly to the other clients and the pawn is movable

heres the function that's called that spawns the pawns and possess them

 void ACustomGameMode::StartRound()
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("ROUND STARTING"));
     TObjectIterator<ACustomPlayerController> Itr;
     for (Itr; Itr; ++Itr)
         ACustomPlayerState* PlayerState = Cast<ACustomPlayerState>(Itr->PlayerState);
         APawn* OldPawn = Itr->GetPawn();
         switch (PlayerState->GetJobChoice())
                     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("CASE DEFAULT"));
                     if (OldPawn) { OldPawn->Destroy(); }
                     FActorSpawnParameters SpawnParams;
                     SpawnParams.Owner = *Itr;
                     SpawnParams.bNoCollisionFail = true;
                     SpawnParams.bNoFail = true;
                         FVector const SpawnLocation = FVector(0, 0, 512);
                         FRotator const SpawnRotation = FRotator(0, 0, 0);
                     UWorld* const World = GetWorld();
                     AActor* const NewHumanPawn = World->SpawnActor(DefaultHumanClass, &SpawnLocation, &SpawnRotation, SpawnParams);
         case 2:
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("CASE 2"));

Product Version: Not Selected
more ▼

asked Sep 04 '14 at 03:10 AM in C++ Programming

avatar image

91 8 11 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi Ensaides,

It maybe related to the Controller current state,because Controller current state is a not replicated value, then may keep the client in other state. So, you can try let all clients call PC->ChangeState(NAME_Playing); after you Possess the Pawn on server side, for example:

 // in your game mode code
 // add this line

then in ACustomPlayerController.h add :

 UFUNCTION(reliable, client)
 void ClientChangeState();

and in ACustomPlayerController.cpp add :

 void ACustomPlayerController::ClientChangeState_Implementation()

Just give a clue, not sure it work or not, beside, Unreal already have a awesome Gameplay framework to organize the game mode, pawn, controller this kind of stuff, you can try to read ShooterGame and UE4 source code, and draw some code maps, it works for me :)

more ▼

answered Sep 04 '14 at 04:09 AM

avatar image

26 2 6 5

avatar image Ensaides Sep 04 '14 at 12:26 PM

that didnt work :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Have you tried:


As stated here Posses Pawn

more ▼

answered Oct 22 '14 at 01:44 AM

avatar image

1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question