How to NOT destroy pawn after logout/exit?
So what I need to do is possess a pawn (in this case a vehicle) but have it unpossess and not be destroyed when the player exits or disconnects.
That way the vehicle can be possessed by another player for example. Problem is the vehicle is destroyed before the controller so there is no easy way of doing that.
How would you go about doing this? There should be an easy way for something like this.. Any help would be greatly appreciated.
asked Apr 11 '15 at 12:29 AM in Blueprint Scripting
Variant for changing the engine. In your C++ class, simply redefine the method by using it.
Create your Controller Class, and make it a function in the similarity:
The redefinition source is in the code: UnrealEngine\Engine\Source\Runtime\Engine\Classes\GameFramework\PlayerController.h UnrealEngine\Engine\Source\Runtime\Engine\Private\PlayerController.cpp
And now the destruction can be regulated through the Blueprints! Yess!
I hope this will add to the standard functionality. After all, the weight of this code is only 138 bytes, and the use of space.
I found a solution for my problem... i guess its the same then yours. In my gamemode BP i want to store in the "OnLogout" several informations of the player pawn, like position, but the pawn is already destroyed in the "OnLogout" by the Unpossess'ing.
So i didnt found a way in BP honestly... my solution for it is to overwrite the UnPossess() of my custom class C_PlayerController and override the "UnPossess()" method to store stuff from the Pawn before it gets unpossessed further. In BP i then just use the value of my storeage variable "unpossessPawnTransform".
The Header part:
The CPP part:
On my gamemode BP it looks like this then:
answered Nov 05 '16 at 01:21 PM
I'm assuming from your post that this is a multiplayer game. I'm not super solid on the multiplayer aspects of UE4, but if I understand correctly, so long as you do not destroy the vehicle on the server when you disconnect the player (on logout) the vehicle should still remain -- if it is not actively possessed by a player; however, I think the issue you're running into is that the pawn is getting removed because it is possessed by a player controller on disconnect.
To resolve this, you can try to using either the Pawn > Un Possess node in Blueprints or using the APlayerController::UnPossess() method() to separate the player controller and pawn before disconnecting the player.
Hope that helps, if not, well at least I tried. Best of Luck
answered Jan 24 '16 at 02:54 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here