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"

Delay between server pawn possession to owner client pawn being possessed?

Hi guys! When the server spawns our player and gives the pawn possession we trigger a event Possessed in our player BP, then we call a replicated function to the owning client telling the client that it has been possessed, then we call a C++ function to setup the players playable objects and its inventory and UI. In our notification replicated function, if we do not put a delay before calling the local setup player C++ function, the C++ function will return early before setting up the placable objects and setting up the UI, because IsLocallyControlled() returns false. If we put a delay there it will return true because the possession apparently takes a bit of time to reach the local player. Is there a way to verify that the local player has been possessed? Preferably having something event based so that we don't have to do continual checking to make sure that we have been possessed before we check if the player is locally controlled.

here is a pic of the BP

alt text


Product Version: UE 4.11
possessionprob.png (168.6 kB)
more ▼

asked May 10 '16 at 12:17 AM in Blueprint Scripting

avatar image

253 8 12 76

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

1 answer: sort voted first

Hi there,

Event Possessed in your pawn fires only on the server. But the possession progress is actually not 100% complete yet.

You can be sure, that the server now knows about this possession, but this information must still be replicated to the client(s).

Here some Code snippets of the PlayerController::Possess function: (I have UE 4.12.5)

             check(GetPawn() != NULL);

The PawnToPossess->PossessedBy(this); part is what actually triggers your Event Possessed you know from your blueprints. However this possess is only known serverside and will not be triggered on the client.

However the function goes on and at the end makes sure, that the client received the possession and also restarts the pawn on the client.

ClientRestart(GetPawn()); then triggers in the pawn the function Restarts;

So for now I overwrite

     virtual void Restart() override;

in my pawn to signal e.g. my UI that it has to update itself/get new references.

One option I still have to further investigate is the OnRep_Pawn() Function in AController.

Although I might stick stick with Restart from Pawn since I can be sure there, that the pawn is actually acknowledged.

more ▼

answered Jul 08 '16 at 09:07 AM

avatar image

67 6 9 15

(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