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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Multiplayer spawn points blueprint

Hello all! I have a question regarding multiplayer spawning, and before I go into that question in detail I am relatively new to UE4 and scripting in general, so bear with me. My question is, is that in a multiplayer game using blueprints how do you make the player spawn on a different spawn point than the other "teams" spawn? I know there is a C++ way to do this, but I need a way to do it in blueprints. Thanks in advance!

Product Version: UE 4.9
Tags:
more ▼

asked Sep 11 '15 at 10:57 PM in Blueprint Scripting

avatar image

Designer102
86 18 19 26

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

2 answers: sort voted first

First create PlayerStart class which you will extend with new variable, called Team, it could be integer with team number (0 could be any team ;]) or enum, you can also create team class or something.

Place your (not default from engine) PlayerStart on level and in detales tab you should able to edit team varable, using it you can set PlayerStart to be set to specific team

In your GameMode on begin play search for all PlayerStarts and put them in array for all teams each (so you got 2 teams you got 2 arrays), depending on there Team varable state (in case of integer, if its 1 put it in first array if 2 then i 2nd array)

Now override (cover over function you will have override menu) FindPlayerStart. This function is called when player is about to spawn and spawn system asks you which PlayerStart to use and it will give you PlayerController of player that is about to be spawned. Based on that assign proper PlayerStart from specific array, by checking in PlayerController is assign to specific team (so in PlayerController you also will need ot ass Team varable).

If you know C++ solution, try to recreate it in blueprints, blueprints use same APIs, it maybe has limited access to it but you can do lot of stuff with it.

There many ways you can go with it, i just give my example, but try thinking for yourself, there will be amny other system to made so you need to develop logical thinking on figuring out to make those systems, or else you end up always asking how to do things

more ▼

answered Sep 12 '15 at 01:09 AM

avatar image

Shadowriver
36.5k 930 169 1111

avatar image Designer102 Sep 24 '15 at 03:24 AM

Thank you! I have modified your answer to fit more of what my game needs, but this helped!

avatar image jestersheepy Oct 01 '15 at 07:49 PM

Great post by ShadowRiver, I added a bool instead of an int and a collision sphere to know if anything surrounding it was taking up the spawn point (good for enemies). Then in the override of the function I got all actors of class - Spawn point, then got the bool and built a new array with the ones who have 'Repsawn taken' set to false, then get a random spawn point from the array and voila!

avatar image Designer102 Jan 08 '16 at 12:07 AM

Nice! Sounds like a well implemented multiplayer system, prevents spawn camping too!

avatar image Snoxx Jul 27 '16 at 08:56 AM

Care to show us an example in blueprints of how to do this?

My team is having troubles making players only spawn at their own spawn after the first few games. The first few games it works fine, but then for some reason after a certain amount of games played (I think it starts bugging out on the 3rd game) it starts spawning players into the enemy base

avatar image MASSIVE Can Mar 18 '18 at 08:40 AM

Hi shadowriver my solution is very similar but I also want to spawn my Player Start actors at the beginning of the game. I spawned them in EventBeginPlay but somehow it doesn’t work. Is there any event that fired before EventBeginPlay? Or how can I delay player spawns?

avatar image LifeArtist Mar 18 '18 at 02:38 PM

I have tried your solution and it doesnt worked. I dont know what I am actually doing wrong. If I override the FindPlayerStart method I get the error Couldn't spawn player: Failed to find PlayerStart what I have done: Creating an array of controllers which gets filled at BeginPlay and just choose the first one out of the array within the FindPlayerStart function override. But the FindPlayerStart gets called before the GameMode BeginPlay function -.-"

avatar image Shadowriver Mar 19 '18 at 04:36 PM

BeginPlay can be too early, make list on the go, when player join or leaves, there events for that in GameMode

avatar image LifeArtist Mar 20 '18 at 01:10 AM

Thanks for your reply, I have work around it now by overriding ChoosePlayerStart and in it: if the playerstarts array is empty get all playerstarts and pick one of them else just pick one.

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

It would be amazing if we could get an update of this. I am trying to build on the Unreal Engine Multiplayer tutorial which is on Youtube but with no success. I am driving myself nuts trying to get this to work. Here is the link to the project file, if anyone would be so kind to take a look at it, especially the OP.

Google Drive Link: https://drive.google.com/file/d/1Spu31zJhjWFkC8LTAAxqyYWriinYX3oh/view?usp=sharing

more ▼

answered Dec 03 '18 at 11:07 AM

avatar image

DudleyGames1
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