Announcement

Collapse
No announcement yet.

Failing to cast to Player Blueprint

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

    Failing to cast to Player Blueprint

    I'm currently trying to cast to the player blueprint via the game mode blueprint, whilst using the 'Get Player Pawn' node as the wildcard object and using a function from the player blueprint as the target. However, this doesn't seem to work as it just results in a cast fail. I've included images below showing the code for the casting operation, as well as the function itself that I'm casting from the player blueprint. If anyone has any advice it would be greatly appreciated.


    #2
    Is there a player pawn? Are you calling this after some sort of player death logic where the pawn is destroyed?
    "I have harnessed the shadows that stride from world to world to sow death and madness."

    Comment


      #3
      Originally posted by EvilCleric View Post
      Is there a player pawn? Are you calling this after some sort of player death logic where the pawn is destroyed?
      I'm not at my computer right now, but I'm fairly certain there is a player pawn. Using the player controller as an object (wildcard) didn't work.

      But perhaps this currently isn't working because there is no pawn or player even spawned at that current time, and this whole procedure IS to get a player to spawn.

      Comment


        #4
        After all you are spawning a "PhysicsBallBP" in the "SpawnPlayer" event, which is called after the cast.

        And what's the purpose of the cast and the get player pawn there?
        Last edited by EvilCleric; 04-20-2018, 03:13 AM.
        "I have harnessed the shadows that stride from world to world to sow death and madness."

        Comment


          #5
          Originally posted by EvilCleric View Post
          After all you are spawning a "PhysicsBallBP" in the "SpawnPlayer" event, which is called after the cast.

          And what's the purpose of the cast and the get player pawn there?
          The purpose of the cast is to activate the 'Spawn Player' function which in turn spawns a player into the level.

          Comment


            #6
            Originally posted by TannerVEVO View Post

            The purpose of the cast is to activate the 'Spawn Player' function which in turn spawns a player into the level.
            I see. So you are spawning a player pawn from the player pawn itself ...
            How about moving the "Spawn Actor" to the gamemode, and then call the "Spawn Player" to do all the rest you have in it?
            Or even do all the spawning operations in the gamemode?
            Last edited by EvilCleric; 04-20-2018, 07:35 AM.
            "I have harnessed the shadows that stride from world to world to sow death and madness."

            Comment


              #7
              Originally posted by EvilCleric View Post

              I see. So you are spawning a player pawn from the player pawn itself ...
              How about moving the "Spawn Actor" to the gamemode, and then call the "Spawn Player" to do all the rest you have in it?
              Or even do all the spawning operations in the gamemode?
              That's a fine idea and sounds like it would work. However, there is an exposed array node in the Player blueprint that gets the spawn locations (which are billboard actors) which are accessed within the 'Default' section in an instance when the player is in a level. While I've created this array variable in the GameMode BP, I'm not sure how I would find the 'Default' section for me to insert these spawn points into. Where would I find them?

              The node within the blueprint, and the array section within the level can be seen in the images below.

              Comment


                #8
                Before anything else, did you check if "Get Player Pawn" is valid? Have you checked if in any moment the instance of the player Pawn gets destroyed or the controller UnPossess it?


                Possible solutions:
                1 - if order doesn't matter, then for example in gamemode, you could use "get all actors from class" or "get all actors with tag" to automatically fill the array
                2 - if order is important, then create a BP, that contains that data
                3 - if you are not using the default player controller, then you can manage all the respawn from there
                4 - ...

                One good tutorial that deals with respawn, player controller, respawn points and all that, is the BP Time Attack Racer ( https://www.youtube.com/watch?v=VJj6...GpCF6LCgBz9XeS ).
                Last edited by EvilCleric; 04-20-2018, 02:02 PM.
                "I have harnessed the shadows that stride from world to world to sow death and madness."

                Comment

                Working...
                X