Creating Multiple Spawn Points

Hello,

I am attempting to create a series of blueprints that will allow the player to cycle through various player start points on the map. At the moment I am using two, and the blueprints allow me to cycle through the initial two spawn points, which is great. However, after I hit the button a third time it spawns the player in 0 world space, outside of the bounds of the level which of course leaves them falling endlessly.

The error I am getting is this: Accessed None’CallFunc_Choose_Player_Start_Selected_Player_Start’ from node SetActorLocationAndRotation in graph ‘UserConstructionScript’ in blueprint BP_FPS_Player. I am not sure what this means besides it’s calling to a point in the blueprint that doesn’t seem to do what it should do, even though it compiles correctly

Here are my current blue prints
BP_FPS_Mode Construction Script and Event Graph

BP_FPS_Player Event and Construction Graph

I’m relatively new to blueprints and I’m not sure that I’m doing this right. I know that the respawn works perfectly fine but the cycling is where the issues seem to be. If anyone has any advice I’d greatly appreciate. Thank you so much for your time.

With your “get all actors of class” node, use the “get” node from result array, and with a random int from range node you can get a random spaw point.

I’m not sure what you mean by that, could you perhaps clarify a bit? I’m truly new to Blueprints, and have mostly been following unreal’s tutorials or this post: Come Learn Blueprint Multiplayer with me! (aka Tom's a Glutton for Punishment) - Blueprint - Epic Developer Community Forums.

OK, What is your problem? You want get a randon spawnpoint right?

No, I’d like to create a series of spawn points that the player can cycle through with the press of a button. For example, I would press J and start near an entry gate, I would then press J again and I would spawn near the patio of a house, I could then press J again and spawn near the garden’s located north of a house and so on.

Basically, with one button press, I’ll cycle through predefined spawn points, not random ones. Alternatively, if it’s easier to bind the spawn points to number keys, ie. 1 - front gate, 2 - patio, 3 - garden, then I would be willing to code that too.

This is for a single player experience mind you.

Do this:

  • On J press, get all actors of class (Player start) →
    array result → get (index) with a int variable.
  • Use it to spawn and then increment this int variable until is greater than the array result of get all actors of class, if greater, reset to zero.
    This will cycle your spawn point in order of placed on map.

If you want specific order, make an array of Player Start references, and use the “picker” on editor in specific order. Then use the same logic before.

Sorry not have a screenshot but I’m not in home.

I’m not sure if I’m doing this right? Trying to follow your advice but as I’m am so incredibly new to the math and properties of Blueprint it’s difficult to suss out. Is this the right direction, and if so or not, what should I do next?

Ignore ADD.
With result of GET, you have your spawn point, use it to set Spawn destination as your previous ScreenShots.

After, SET Array variable to +1. IF greater than “Out Actors → Length” SET to Zero. To set to +1 just use “increment” node.

Did I mention I’m bad at math? Thank you so much for sticking through this with me, I’ve hardly ever coded in my life so this is like learning a new language. Here is what I have so far:

Obviously it’s not there yet but I wasn’t sure if A) what I had was right and B) how to set the length to 0?

Steps

1 - Click-n-drag out Actors, on context menu search for length.

2 - Connect length node to 2nd pin of greater than node.

3 - Connect array var to diamond pin on ++ node.

4 - delete green GET node.

5 - delete make array node

6 - delete last length node

7 - after ++ node, on arrow connect a branch node.

8 - Connect the RED pin of greater than node to red pin of branch node.

9 - Grab your array var from panel at right side of screen and place next to branch node, and on context menu show, choose SET. Connect it to TRUE output of branch node.

With this, You have a Start Point Cycle. Each time you press J.

Now, with the result of BLUE GET node, and at END before of SET OWNER You can “Spawn” your character.

Alrighty, so that absolutely worked, I now respawn when ever I hit J.

However, it doesn’t cycle me through the two player starts that I have on the map. Once I hooked up the get actor transform’s target to the choose player start target in the construction script, however, it started cycling. Though it once again sent me to world space 0 after 3 presses.

I think it might have to do with that bit of coding more so than the press J. Any thoughts? Thank you so much again for all of your help, I truly appreciate it.

This worked for me.

Awesome, I’ll give it a look see when I’m back at work on Monday and let you know how it goes. Thank you so much for all of your help.

Alrighty, so I’ve plugged in this code and it starts me off at PlayerStart2. Once I press J it respawns me at PlayerStart and every subsequent press of J will respawn at PlayerStart. It doesn’t seem to cycle through the starts.

The way I understand the code is that my index is 0 and if 2 - 1 >= 0 then set 0 to 0 else add 1 and repeat. It seems like it gets stuck in the loop after one cycle though so I’m not sure what to do to fix that?

Here’s an image of the blueprint I plugged in, though as near as I can tell it mimics yours:

If there is anything else I can give to help with addressing this issue please let me know, I’m utterly stumped. Thank you so much.

I went ahead and decided to just make a multi-thread teleport, as this seemed to be an overly convoluted way to respawn the character and I just couldn’t get it to work. Perhaps I was overthinking something as simple as just moving the character from one point to another.

Still not sure how to get this method to work, but for now that’s ok. Thank you so much for all of your help and patience. I truly appreciate it.