vehicles: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(46 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.00


|1.00|= Game version
|game2= arma2
____________________________________________________________________________________________
|version2= 1.00


| Returns a list of all vehicles. |= Description
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| '''vehicles''' |= Syntax
|game4= tkoh
|version4= 1.00


| [[Array]] |= Return value
|game5= arma3
____________________________________________________________________________________________
|version5= 0.50
 
|x1= <code>_vehicles = [[vehicles]];</code> |= Example 1
____________________________________________________________________________________________


| [[allCurators]], [[allGroups]], [[allDead]], [[playableUnits]], [[switchableUnits]], [[allUnitsUAV]], [[allDeadMen]], [[agents]], [[allUnits]] |= See also
|eff= local


}}
|gr1= Object Detection
 
|descr= Returns an array of all vehicles available to current client. This command returns both empty and crewed vehicles <u>but not soldiers</u>. It will also return "WeaponHolderSimulated" of dead bodies (weapon on the ground). Vehicles created with [[createVehicleLocal]] will only be returned on the client that created them.
 
|s1= [[vehicles]]
 
|r1= [[Array]]


<h3 style="display:none">Notes</h3>
|x1= <sqf>_vehicles = vehicles;</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on June 24, 2007
<dt class="note">'''[[User:5133p39|5133p39]]'''
<dd class="note">(A1 1.08 )This command is returning '''only vehicles''' and '''no soldiers'''.


<dd class="notedate">Posted on July 15, 2011
|seealso= [[allGroups]] [[allUnits]] [[units]] [[entities]] [[agents]] [[playableUnits]] [[switchableUnits]] [[allPlayers]] [[allDead]] [[allDeadMen]] [[allUnitsUAV]] [[allCurators]] [[allObjects]] [[allMissionObjects]] [[allSimpleObjects]] [[allMines]]
<dt class="note">'''[[User:kju|kju]]'''
}}
<dd class="note">(A2 1.51)It returns both empty and crewed vehicles.


<dd class="notedate">Posted on december 22, 2013
{{Note
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
|user= Sa-Matra
<dd class="note">(A3)It will also return "WeaponHolderSimulated" of dead bodies (weapon on the ground).
|timestamp= 20240618061800
</dl>
|text= This command returns a lot of crap that is not really a vehicle in a common sense - simulated weapon holders, clutter cutters, etc. It also skips "out" vehicles (disassembled drones and statics). Be careful iterating through it as it may be expensive.


<h3 style="display:none">Bottom Section</h3>
Here is a list of most vehicle simulations that are returned by this command:
<sqf>
airplanex
artillerymarker
car
carx
fire
helicopterrtd
lasertarget
motorcycle
nvmarker
parachute
paraglide
rope
shipx
submarinex
suppresstarget
tankx
thing
thingx
</sqf>
Generated using this code bit:
<sqf>
private _sims = createHashMap;
{
private _sim = toLowerANSI getText(_x >> "simulation");
if!(_sim in _sims) then {
_sims set [_sim, configName _x];
};
} forEachReversed ("getNumber(_x >> 'scope') > 0" configClasses (configFile >> "CfgVehicles"));


[[Category:Scripting Commands|VEHICLES]]
private _used_sims = [];
[[Category:Scripting Commands ArmA|VEHICLES]]
{
[[Category:Scripting Commands ArmA2|VEHICLES]]
if(createVehicle [_y, [random 1e5,random 1e5,random 1e5], [], 0, "CAN_COLLIDE"] in vehicles) then {
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
_used_sims pushBack _x;
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
};
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
} forEach _sims;


<!-- CONTINUE Notes -->
_used_sims sort true;
<dl class="command_description">
copyToClipboard (_used_sims joinString toString [10]);</sqf>
<dd class="notedate">Posted on August 4, 2017 - 11:34 (UTC)</dd>
There is probably more simulations not listed like non-x versions of vehicle simulations but these are ones actually used in A3.
<dt class="note">[[User:IT07|IT07]]</dt>
}}
<dd class="note">
[ ArmA 3 v1.72.142223 ] does '''not''' return vehicles that are local.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 11:34, 3 September 2024

Hover & click on the images for description

Description

Description:
Returns an array of all vehicles available to current client. This command returns both empty and crewed vehicles but not soldiers. It will also return "WeaponHolderSimulated" of dead bodies (weapon on the ground). Vehicles created with createVehicleLocal will only be returned on the client that created them.
Groups:
Object Detection

Syntax

Syntax:
vehicles
Return Value:
Array

Examples

Example 1:
_vehicles = vehicles;

Additional Information

See also:
allGroups allUnits units entities agents playableUnits switchableUnits allPlayers allDead allDeadMen allUnitsUAV allCurators allObjects allMissionObjects allSimpleObjects allMines

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Sa-Matra - c
Posted on Jun 18, 2024 - 06:18 (UTC)
This command returns a lot of crap that is not really a vehicle in a common sense - simulated weapon holders, clutter cutters, etc. It also skips "out" vehicles (disassembled drones and statics). Be careful iterating through it as it may be expensive. Here is a list of most vehicle simulations that are returned by this command:
airplanex artillerymarker car carx fire helicopterrtd lasertarget motorcycle nvmarker parachute paraglide rope shipx submarinex suppresstarget tankx thing thingx
Generated using this code bit:
private _sims = createHashMap; { private _sim = toLowerANSI getText(_x >> "simulation"); if!(_sim in _sims) then { _sims set [_sim, configName _x]; }; } forEachReversed ("getNumber(_x >> 'scope') > 0" configClasses (configFile >> "CfgVehicles")); private _used_sims = []; { if(createVehicle [_y, [random 1e5,random 1e5,random 1e5], [], 0, "CAN_COLLIDE"] in vehicles) then { _used_sims pushBack _x; }; } forEach _sims; _used_sims sort true; copyToClipboard (_used_sims joinString toString [10]);
There is probably more simulations not listed like non-x versions of vehicle simulations but these are ones actually used in A3.