x

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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Missing "RemovePlayer" node

In C++, you are able to remove players via the gameInstance, but in Blueprint there is currently no node to do so.

Check the answer section of a proposed fix for this of me.

I hope to see this in Unreal Engine at some point.

Cheers.

Product Version: Not Selected
Tags:
more ▼

asked Feb 11 '15 at 12:46 PM in Blueprint Scripting

avatar image

Eduard Gotwig
156 12 17 43

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

EDIT: As of now it seems to be not working.. for now im going to use this deprecated (!) code instead: https://answers.unrealengine.com/questions/140342/how-do-i-remove-a-second-splitscreen-player.html

Add a new Blueprint Function library, with the name "UBP_FuncLib" and add this code for the cpp file :

 #include "CarCarCar.h"
 #include "UBP_FuncLib.h"
 #include "Runtime/Engine/Classes/Engine/GameInstance.h"
 
 
 
 void UUBP_FuncLib::RemoveSplitscreenPlayers()
 {
     const int32 MaxSplitScreenPlayers = 4;
     ULocalPlayer* PlayersToRemove[MaxSplitScreenPlayers];
     int32 RemIndex = 0;
 
     for (FConstPlayerControllerIterator Iterator = GEngine->GameViewport->GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
     {
         // Remove only local split screen players
         APlayerController* Controller = *Iterator;
         if (Controller && Controller->IsLocalController() && !Controller->IsPrimaryPlayer())
         {
 
             ULocalPlayer* ExPlayer = Cast<ULocalPlayer>(Controller->Player);
             if (ExPlayer)
             {
                 PlayersToRemove[RemIndex++] = ExPlayer;
                 Controller->PawnPendingDestroy(Controller->GetPawn());
             }
         }
     }
 
     UWorld* currentWorld = GEngine->GetWorld();
     UGameInstance* gameInstance = currentWorld->GetGameInstance();
 
     for (int32 i = 0; i < RemIndex; ++i)
     {
         gameInstance->RemoveLocalPlayer(PlayersToRemove[i]);
     }
 
 }
 

For the .h file add this code:

 #pragma once
 
 #include "Kismet/BlueprintFunctionLibrary.h"
 #include "UBP_FuncLib.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class CARCARCAR_API UUBP_FuncLib : public UBlueprintFunctionLibrary
 {
     GENERATED_BODY()
 
 public:
     UFUNCTION(BlueprintCallable, Category = "CustomLibrary")
     static void RemoveSplitscreenPlayers();    
 };
more ▼

answered Feb 11 '15 at 12:49 PM

avatar image

Eduard Gotwig
156 12 17 43

(comments are locked)
10|2000 characters needed characters left
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