Page MenuHomeFeedback Tracker

'vehicle player' returns player object when player is in vehicle
Closed, ResolvedPublic

Description

In some situations, the 'vehicle player' command returns the player object, rather than a vehicle object, even though the player is in the driver seat of a vehicle.

I first noticed this issue Friday (27.03.15), while working on a part of a mission I am developing with some friends. The mission is a Capture the Island game mode, and as part of it, two unarmed MRAPs are positioned for each team at the start of the mission. When I, or any other player, enters these MRAPs, the 'vehicle player' command returns the player object, as opposed to the vehicle object.

This behaviour is peculiar, and as such I sought to reproduce the problem. I made efforts to disable any mods that were running in my game, and created a new mission in the editor with one playable unit. I launched the mission and used the console to execute the createVehicle command to spawn a Hunter MRAP and a Pawnee helicopter. I proceeded to enter each, and tested what the 'vehicle player' command returned. In both vehicles, the player object was returned, rather than either vehicle object.

I cannot fathom how the vehicle command could return the player object when the player is in a vehicle, unless the internals of the command have been somehow broken.

Details

Legacy ID
4065978167
Severity
None
Resolution
No Bug
Reproducibility
Sometimes
Category
Scripting
Steps To Reproduce

Create an empty mission, deploy MRAPs through the console using createVehicle command, and then inspect the value of the 'vehicle player' statement.

Event Timeline

Bluecewe set Category to Scripting.
Bluecewe set Reproducibility to Sometimes.
Bluecewe set Severity to None.
Bluecewe set Resolution to No Bug.
Bluecewe set Legacy ID to 4065978167.May 8 2016, 11:46 AM

How did you test that vehicle player returns player?

vehicle player == player returns true?

I used 'systemChat format ['%1', vehicle player]'.

try

systemChat format ['%1', vehicle player == player]

and report back

vehicle player == player is worthy to know if the player is inside a vehicle or not, even if it seems there is no difference between them!
Try : 0 = [] spawn {while {true} do {hintSilent format ["%1 %2 %3", player, vehicle player, vehicle player == player]; sleep 0.5}}. The only thing which changes is true/false for out/in vehicle.

The fact is an empty vehicle returns an object until it has a crew.
Then it returns the driver or more exactly the gunner if not driver if not commander.

Btw, One other point: Empty vehicles can change side!
If your bluefor units jump into an empty ifrit, ifrit stays civilian until your first man is inside. Then it becomes of one of your side (OK, it's the driver's one in fact). Make the units dismount, the Ifrit returns to civilian side (normal).

Now, order the same thing to your blues, but jumping into a Hunter.
First difference: the vehicle changes side (from civilian to yours) as soon as you order it. (no delay!)
Hunter will return the name of driver only when he's climbing aboard (no change).
Then, if you order all your units to dismount the hunter, this vehicle will continue to belong to your side!!! Emptied Hunter is no more civilian!
You can test it when you want with a simple
0 = [] spawn {while {true} do {hint format ["side: %1",side cursorTarget]; sleep 0.5}};
In the short video below, I display some units data:
name/type of civilian units are in white.
When a unit is friendly, name/type is in green.
Furthermore, if unit belongs to my (player) side, i add data such as ammo, fuel, status are displayed.
Ready? Pay attention for empty Hunter. ;-)
https://www.youtube.com/watch?v=Ch5fiiN-v6k

This is so wrong. I have debunked this before. Try actually naming the vehicle and see the results. Here is the conversation I had last time someone brought this up. https://community.bistudio.com/wiki/Talk:vehicle

Just because two things look the same doesn't mean they are. It's not returning the player object, its returning whatever the hell it wants to until you actually label that vehicle.

Thanks for the suggestion, Killzone_Kid. This is a non-issue. It turns out that I was dealing with another, unexpected, behaviour in my scripts from another command.