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"

PlayerStarts and Spawning

Hi there

This is maybe kind of a silly question and I found some similar topics in the forum and also on Google but none of them answer my question. How does the spawn system work in UE4? And is there a way to override it?

I have a soccer field level with total 7 PlayerStarts (3 for each team and 1 for the ball). Before the game starts there is a "Wait for other players" widget and after that, the server spawns all players depending on which team they are (Kind of like in Rocket League) I have dummy pawns as default pawn class that should all spawn at the same location but they spawn randomly (depending where the camera in the editor was, when the level was saved I believe)

Now is there a way to define on which PlayerStart the pawns spawn or do I have to make other objects (like target points or so) for my 7 spawn points and just one PlayerStart object?

Edit: I use Blueprints.

Product Version: UE 4.12
more ▼

asked Jun 20 '16 at 03:01 PM in Using UE4

avatar image

168 6 12 11

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

3 answers: sort voted first

I thought I might resolve this since I now know whats actually going on with the cameras.

There is an option in the Class Defaults of Player Controllers called "Auto Manage Active Camera Target"

  • True: the camera switches automatically, when posessing a pawn. If the pawn doesn't have a camera attached, it "creates" one on the world location of the pawn and uses this one.

  • False: you'll have to control the camera manually with functions like "Set View Target with Blend", which takes an actor as input and uses the active camera of that actor. The camera will not automatically change on pawn posession

The way the camera flow works is like this:

  • Spawns Player Controller that has a Camera on the World Location: 0,0,0

  • Waits for a Player Pawn that gets posessed by the Player Controller to use its camera or waits until the camera gets set manually by code

So I guess the best way is to set the view target on Begin Play inside the Player Controller and not using dummy pawns for, in this case the "Wait for player" widget view.

For the actualy character spawning, use one of the above answers.

more ▼

answered Oct 14 '18 at 11:40 AM

avatar image

168 6 12 11

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

The key is your GameMode. This is where the logic goes to handle player creation. If nothing is defined in the game mode, the game will simply select a random PlayerStart. If no PlayerStarts exist, the game will use 0, 0, 0.

If you click on your player start object you'll see 'Tags' under Actor. This can be used to give your player starts an ID of some sort that you can reference in your blueprint. For example, you can fetch all of your player starts, then loop through looking for the ID you care about (using a Actor Has Tag node).

In your case I'd tag your PlayerStarts like:

  • blue_start_1, blue_start_2, blue_start_3

  • red_start_1, red_start_2, red_start_3

  • ball

Beyond that it's a matter of tracking state to figure out where to spawn. When you're trying to manually find a start position, you need to see if it's available (another Actor could have taken it already). Actor is available? Possess it! Try exploring Find Player Start in your Game Mode returning a PlayerStart actor (I also believe Choose Player Start is an option to explore as well). Feel free to dig into the API docs to see what's available (look for Blueprint functions, denoted on the left).

Might also dig into this re: respawning -- https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/RespawnPlayer/Blueprints/

Hopefully this gets you going! Let me know if you have further questions & I'd be happy to continue thinking this through with you.

more ▼

answered Jun 20 '16 at 04:16 PM

avatar image

396 16 8 16

avatar image Lord7even Jun 20 '16 at 06:07 PM

That's what I've setup already. The player spawning works fine. I did a similar thing like Discodude16 shows in the answer below. (Just the camera rotation is sometime on team 1 facing the wrong direction (character direction/rotation is fine).)

My question is more about the camera-pawn spawning that happens before the actual player character spawn. But I guess I have to set that up as well, like I did the soccer-player character spawn. I just thought that there is some other mechanics behind the spawning system of UE4.

Anyways, your answer made things clearer and now I know, that my attempts were all pretty much right. ;-)

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

Hello. I hope that this answers your question. I have made a function in the gamemode script that can be called at any time, such as when the widget detects that all players connected. Here is a picture of the function.alt textalt text I have used the location of the player starts as the transform. (The variables are vectors that were set to that location.) Hopefully this helps.

spawnscript1.png (199.2 kB)
spawnscript2.png (126.5 kB)
more ▼

answered Jun 20 '16 at 04:23 PM

avatar image

48 11 8 14

avatar image Lord7even Jun 20 '16 at 06:11 PM

Thanks for the BP screens. I've something similar setup already but this is kind of a simpler way than my solution. My question depends more on the camera-pawn spawn but I guess I have to set that up as well, like the actual soccer-player character.

(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