How to Exit/Enter Vehicle?

I am following these steps:

I can “Cast To ThirdPersonCharacter” added to my Sedan blueprint, and I am trying to add “Set NearCar” to the blueprint, but it refuses to allow me to use “Set” or “Set NearCar”

How do I insert this “Set” function?

Im not any kiind of expert but first the car must be pawn or caracter controller and you need to use Posses to take control of the car and the carr must have set up his own intputs

“Context Sensitive” strikes again! I swear that box keeps checking itself after I have unchecked it. I was able to find the “SET” box once this was fixed.

NEXT PROBLEM: When I run this I get a Message Log:
Accessed None ‘Player’ from node Activate in blueprint Sedan

I am guessing this means the Player was not initialized. Where on this tutorial was I told to initialize it?

How do I fix it?

you drag the variable for the panel and drop it into the blueprint event graph then it will ask you if you want “get” or “set”

I received a dozen or more “Accessed None Player” errors now, and each time have removed every offending function from the Sedan blueprint.

Unfortunately, the final error is with the Construction Script “Accessed None Player” and I can’t delete the construction script.

I named my ThirdPersonCharacter instance “Player” and I named the Sedan instance “Car”, hoping that would make the link between the variables in the blueprints, but that did not work.

This tutorial really does not seem to show how to get “Player” initialized. Step 12 says “Return to the Sedan Blueprint and add a Character variable called Player”

The next reference to “Player” is in step 19. When I drag “Player” to the blueprint, it pops up an unexpected Get/Set dialog. I assume Get is what is wanted.

Step 23, 24, 25, and 28 the “Player” is connected in the blueprint.

Step 37 looks like “Player” is getting set by “Self” Is this the initialization that is being missed?

The next thing I tried was deleting the existing Sedan, and dragging the sedan blueprint out into the world. Now when the game starts, the ThirdPartyCharacter starts, and he can successfully enter the car. However, the car will not drive, and the <E-Key> won’t take the guy out of the car.

What else am I missing?

You are missing the basic of C, C++ and because of this also of Blueprint: POINTERS

“Accessed None” tells you, that you tried to use a pointer which is not pointing to anything. It is just “NULL” which is some kind of an empty state.

An INT variable can’t be empty, but a pointer can. Everytime you create a variable with an actor type (like APawn, ACharacter, AController, etc.) you create a pointer
and as long as you don’t fill it with a real reference (like the spawned PlayerCharacter) it will be NULL. And if you try using it (like getting the health or position of the player)
while it is NULL, you will get this error, because you have nothing to get something from.

So you need to fill it somehow. The tutorial does this here:

It is using the Car variable (which is hopefully set somewhere, otherwise we would have another NULL error) and casting it
to the Car BP Class. After that, it uses the “Set Player” node, to set the Player Variable inside the Car BP.

“Self” is a reference to the PlayerCharacter itself (or any other Class when you use “self” inside of it).

So at this point the variable gets filled.

If you have more questions, feel free to ask me.

I definitely have more questions. Lets try to make this as simple as possible.

  1. create a brand new VehicleTemplate w/blueprint project.
  2. from the Launcher Library tab, add the Animation Starter Pack to the new Vehicle project
  3. In the sedan properties, change Auto Possess Player to disabled
  4. drag the ASP_Character into the world
  5. open the ASP_Character blueprint and add a variable “Car” of type Sedan
  6. open the Sedan blueprint and add a variable “Player” of type ASP_Character
  7. Put these elements in the Sedan Blueprint:
  8. switch to the ASP_Character blueprint and add these elements:

This now runs without error, but pressing “F” to switch from the Sedan to the ASP_Character does absolutely nothing.

This bare-bones test is too simple. What else must be added?

This can’t really work. What is the start character you have? Do you start with the Sedan possesed or with the player?

These variables aren’t set as far as i can tell. Either you have Car NULL or Player. So you need to set this with an overlap or something.

EDIT: I added a box collision to the Sedan (scaled it) and added an OverlapEvent for it. I casted the Other Actor to the ASP Character and filled the player Variable with that.
I did the same with the capsule collision of the ASP character and casted the other actor to Sedan. After that i filled the Car variable with that.

With this i have the References filled as soon as these two overlap.

Inside the SeganBP:

Inside the PlayerBP:

And i’m pretty sure they do this similar in the tutorial. This will allow you to switch the two as soon as you are near it (overlapping the collision volumes)

Thanks for the detailed simple example. It often works now. I don’t quite know what is happening when it does not work, but this is close enough for now.

The actors need to overlap with this method (and they also need in the tutorial). So i guess they are just not overlapping.

One of the other Mod’s here on the forums created a GTA style enter/exit vehicle prototype that includes a download of the full system. It might be helpful to see how he made it, then compare it to your current setup to see what might be different. Hope it helps!

Here’s the thread:

I made the hitbox around my ThirdPartyCharacter much bigger, and now I can park next to him and switch every time.

Thanks for all the help. I will check out the GTA style link too. This is fun!

If I wanted to do a skateboard or hoverboard, how would I set up a BP for it?

I am trying to set a simple hover board the player can step onto and fly around.