Page MenuHomeFeedback Tracker

Command 'vehicle' does not act as expected.
Closed, ResolvedPublic

Description

vehicle as is stated in the documentation does not work in Arma 3. the vehicle will always equal the player; however, you can get the class name of the vehicle in this manner(where _x is a player):

When I use this in my code:

if (vehicle _x != _x) then {

then it always returns false. It recognizes my player, but 'vehicle _x' returns _x always.

However if I do the following:

typeOf (vehicle _x)

and it will properly get the class name of the vehicle that the player is in. So to properly see if the player is in a vehicles you would need to do something like this(where _x is a player):

if (typeOf _x != typeOf (vehicle _x)) then {...

So either the documentation is wrong, or something is wrong with arma.
{F22747}

Details

Legacy ID
335544008
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Use the following code when in a vehicle and you will never see the hint.

if (vehicle player != player) then {

hint "You are in a vehicle.";

};

or this:

hint format ["Value: %1", (vehicle player != player)];

Event Timeline

somners edited Steps To Reproduce. (Show Details)Nov 13 2013, 4:55 PM
somners edited Additional Information. (Show Details)
somners set Category to Scripting.
somners set Reproducibility to Always.
somners set Severity to None.
somners set Resolution to No Bug.
somners set Legacy ID to 335544008.May 7 2016, 5:24 PM

The command works as intended. vehicle player will return either vehicle the player is in (if player is in a vehicle) or it will return player object (if player is not in a vehicle).

if (vehicle player != player) then {

hint "You are in a vehicle.";

};

I've added screenshot

somners added a subscriber: somners.May 7 2016, 5:24 PM

This is very peculiar, It really wasn't working the other day with the same code... guess this issue is closed.