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"

Respawning in Multiplayer RPG

Hi guys!
I'm currently trying to make a good respawning system for a multiplayer RPG where progress is kept between deaths and variables of the character actor are not reset.

Since I don't want the camera to "spaz out" when the player dies and the actors gets destroyed, I tried keeping the actor and simply disabling movement input and activating the ragdoll on death.

Then I tried changing the position of the player in my OnRespawn() to the position where I want him to respawn, and stopped all ragdoll action.

This gives me strange results.
I can respawn and move, but the model still lies there and the newly "respawned" player doesn't have a model or collision or is replicated.

What would be a better way to respawn in the RPG scenario where progress is kept?

I want to achieve this, but I'm kinda out of ideas now:

  • Kill player, respawn and still keep the variables.

  • The camera should not move when he dies. It should stay in the position where it was just before he died until he hits a respawn button on a widget. (lesser problem)

  • The player should only be able to interact with the UI and not the game when he's dead. That's probably done with SetInputModeUIOnly()

  • Ragdoll should not be replicated, respawned actor should be replicated again.

    In General, what would be a good way to handle respawn in that MP-RPG scenario?

    ou don't need to spoonfeed me the code, I just need some information on where to start or maybe a basic bullet point list of how I could approach the different aspects of the problem.

Thanks for your time and help!

Product Version: UE 4.8
more ▼

asked Sep 15 '15 at 06:04 PM in C++ Programming

avatar image

176 12 19 191

avatar image mrooney Sep 15 '15 at 06:55 PM

What kind of variables are you trying to keep on the character actor?

avatar image blueshifted Sep 15 '15 at 07:05 PM

His stats (int values) and his inventory (TArray).
Basically all the stuff you want to keep in an RPG where character stuff is stored on the server.

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

1 answer: sort voted first

You may want to consider moving that into the playerstate instead of the character. The character is better thought of as a wrapper for the actual pawn not the player.

The playerstate will exist regardless of what happens to the character, and it will exist across clients and on the server. The Playerstate should hold everything everybody needs to know about the player, the player controller is best thought of as the actual player, and the pawn is kind of just like a puppet whose puppeteer is the player.

Broad info here https://docs.unrealengine.com/latest/INT/Gameplay/Framework/QuickReference/

more ▼

answered Sep 15 '15 at 09:14 PM

avatar image

703 40 32 123

avatar image blueshifted Sep 15 '15 at 09:42 PM

Ahh how could I miss such a basic thing?
Thanks for this, I will rewrite my code and mark this as an answer.

(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