Making Interactable Vehicles

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By StrikerSVX

I’m not sure about how could be done, i already have a “fps” with a player that can move, sprint, jump and shoot, based on the doom tutorial by miziziziz, and i know how to make a vehicle using the vehicle nodes and some scripts from the vehicle tutorials by Bastiaan Olij, now i need to make that the player can enter the vehicle, what do i do? make player = vehicle, but how would i make the controls work? or maybe i need to remove the player then add the vehicle, but removing the player may be not the right way. I would apreciate any help if possible.

This isn’t very specific. There are many ways to do this, it depends on how you wish to set it up, such as is the player going to be parented to the vehicle or be removed/invisible whilst controlling the vehicle?

Magso | 2020-01-19 15:03

the most basic way, probably making the player invisible, because if i add something like a capture the flag, removing the player may remove the flag, or drop the flag like team fortress 2 do when you enter a respawn room, but halo don’t drop the flag when you enter the vehicle, my question is how would be made like changing the controls from player to vehicle and vice versa.

StrikerSVX | 2020-01-19 15:56

The easiest way to be to use bools to determine which to control.
e.g.

if player:
    #player behaviour
elif vehicle:
    #vehicle behaviour

But depending on the setup of the game this may have to be done through separate scripts for each type of player.
E.g. the player script could be something like this

if !vehicle:
    #player behaviour
else:
    Player.visible = false
    #call function in vehicle script

Magso | 2020-01-19 16:31

Interesting, thanks for the help!

StrikerSVX | 2020-01-20 01:29