Announcement

Collapse
No announcement yet.

player start: what's the point?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    player start: what's the point?

    so I have 2 characters in my blueprint, a pawn for VR HMD/motion controllers and a character for gamepad/screen. they are not positioned in the world, I just set my level blueprint to spawn a different character if I have HMD enabled or not. I needed a transform to spawn them into, so I added a player start into the world and referenced its transform in my blueprint. it works, but the player start spawns a sphere, which googling about it revealed that it's the default pawn.

    why is player character spawning a default pawn when I'm spawning another character/pawn? what am I doing wrong?
    behance.net/fael097

    #2
    This is a series I made about blueprints that covers a lot of the basics for people getting started. Check out video #19 it goes over the "game mode". This is where you set the default pawn, controller, HUD etc for the level you are in. A player start will always spawn the chosen "default" player pawn for that level based on the game mode's definition of what the default is set to. You don't really need a "transform" to spawn the character in if you use the player start. It will auto spawn the appropriate character if you switch the game mode based on whether you use the HMD or not.
    https://www.youtube.com/playlist?lis...1jewB5s78zQHIy

    Comment


      #3
      Originally posted by Nebula Games Inc View Post
      This is a series I made about blueprints that covers a lot of the basics for people getting started. Check out video #19 it goes over the "game mode". This is where you set the default pawn, controller, HUD etc for the level you are in. A player start will always spawn the chosen "default" player pawn for that level based on the game mode's definition of what the default is set to. You don't really need a "transform" to spawn the character in if you use the player start. It will auto spawn the appropriate character if you switch the game mode based on whether you use the HMD or not.
      https://www.youtube.com/playlist?lis...1jewB5s78zQHIy
      hey, I watched your vid, thanks for that

      so basically, instead of making a script to switch characters I'd have to make one to switch between different game modes with the character I want as the default pawn? should I script this inside the level blueprint?
      behance.net/fael097

      Comment


        #4
        i would script it in the game instance because it persists between levels so changes you make in a "loading level" will carry over. It can also easily be accessed from any other blueprint using the "get game instance" function call as opposed to the level BP which is much more challenging.

        Comment


          #5
          understood, makes sense.

          but how to dynamically load a different game mode when starting the game? is there a node to set game mode? I couldn't find how to and searching a bit revealed that game mode can't be changed while the game is running. perhaps when launching it can choose which one to begin, but how?
          behance.net/fael097

          Comment


            #6
            Gamemode doesn't have to contain just '1' game mode only....
            There are BP nodes that let you get the command-line string...
            But they don't work in the Editor/PIE iirc so testing is a PITA!
            Last edited by UnrealEnterprise; 05-07-2019, 03:03 PM.

            Comment


              #7
              ok I don't get it anymore. let's start again:

              the only thing I want to do is, when I start the game, check if HMD is enabled, and if not, then spawn my character 1 named say "ScreenCharacter", and if it is enabled, then spawn my character 2 named say "VRPawn".

              where do I put this script? the level blueprint? game mode blueprint?
              behance.net/fael097

              Comment


                #8
                I'd put it in the GameMode. You can assign your default GameMode BP class for every level, but you cannot have a "generic" Level BP class that serves as a parent to every Level BP.

                So if you put the script in the Level BP, you need to copy it to every Level BP in your game. If you put it in a custom GameMode (or GameModeBase), you can just script it once and set the default GameMode to your custom GameMode.

                Comment


                  #9
                  Originally posted by DsyD View Post
                  I'd put it in the GameMode. You can assign your default GameMode BP class for every level, but you cannot have a "generic" Level BP class that serves as a parent to every Level BP.

                  So if you put the script in the Level BP, you need to copy it to every Level BP in your game. If you put it in a custom GameMode (or GameModeBase), you can just script it once and set the default GameMode to your custom GameMode.
                  ok, now how do I spawn it? spawn actor node requires a transform, and I can't seem to get the transform of a player start actor from inside the game mode blueprint
                  behance.net/fael097

                  Comment


                    #10
                    Haven't tried it myself but you should be able to get it using Get All Actors of Class and taking the first element from the output array (assuming you have only one PlayerStart actor in the level).

                    Comment


                      #11
                      Originally posted by DsyD View Post
                      Haven't tried it myself but you should be able to get it using Get All Actors of Class and taking the first element from the output array (assuming you have only one PlayerStart actor in the level).
                      ah yes, forgot about this node. well it works, so thank you!
                      behance.net/fael097

                      Comment


                        #12
                        An actually more relevant question: if the player start actor always spawn the default pawn in game mode, then what's the point anyway? why no just drag the default pawn into the level instead of a player start?
                        behance.net/fael097

                        Comment


                          #13
                          Because you can change the "default" pawn and still have the new pawn spawn in exactly the same location without having to delete the character you dragged in and replace it with the new one. Imagine if you had a character selection menu....you can't have a character already in the level because you don't know what the player will choose. Having a "player start" allows you to determine where ANY player character will begin in your level without having to specify which character it is before hand.

                          Comment


                            #14
                            Originally posted by Nebula Games Inc View Post
                            Because you can change the "default" pawn and still have the new pawn spawn in exactly the same location without having to delete the character you dragged in and replace it with the new one. Imagine if you had a character selection menu....you can't have a character already in the level because you don't know what the player will choose. Having a "player start" allows you to determine where ANY player character will begin in your level without having to specify which character it is before hand.
                            This makes sense, I thought that was the case, but how do I actually change the default pawn via blueprint?

                            I currently have my game mode's default pawn set to none, and a dummy player start actor dragged into the game just as a reference for transforms. then in my game mode blueprint I have a "spawn actor of class" on begin play, and a branch for if head mounted display is enabled then spawn "VRpawn" and else spawn "gamepadpawn", and then I use the player start transform as a location for the pawns to start. this is not very intuitive, I should be able to just change the default pawn on that branch instead of spawning an actor, however I googled how to do this and didn't find anything, only found that you can't change the default pawn while in game, and I'm not sure if on begin play counts as already in game or not. so how do I do this properly?
                            behance.net/fael097

                            Comment


                              #15
                              I have never done it but who says you can't change at runtime? Looks like you can. Of course you can't do this once a level has started as the default pawn will have already been created but. You should be able to do it in a menu level, store the new default pawn class in the game instance or something and then pass it along prior to opening up the first level.

                              Attached Files

                              Comment

                              Working...
                              X