From Bohemia Interactive Community
Jump to navigation Jump to search

KillZone Kid mentions ' "vehclass" createVehicle pos is the same if not faster than createVehicle ["vehclass", pos, [], 0, "NONE"] ' but this is not entirely true. I believe it should read: "vehclass" createVehicle pos is the same if not faster than createVehicle ["vehclass", [pos select 0, pos select 1, 0], [], 0, "NONE"] --Zectbumo

Why? You say you "believe" it should read that way. Why do you believe that? Please explain. Why does selecting pos's X and Y values, but not it's Z value make it faster? You are still passing a number as the third position array parameter. If anything your example should be slower because you are using the select command twice. --Benargee (talk) 01:48, 28 November 2015 (CET)
I think he is suggesting that the non-array createVehicle syntax will always create vehicles at ground level whereas the array syntax won't necessarily (aka, he's talking about equivalent behaviour rather than speed). I can't verify off the top of my head if that's the case, but in response to the original question: for demonstrative purposes it is assuming the position is at ground level. --SS (talk) 14:47, 28 November 2015 (CET)
Parsing of array of params to the command always takes longer than a single argument. Other than that commands seem identical.Killzone Kid (talk) 14:56, 28 November 2015 (CET)
I only wrote "believe" because I could be wrong just like Killzone Kid believed what he said was to be true. The only way to be sure is to see the source code for the createVehicle function. From what I experienced I see that the two syntax versions are not the same. The short version ignores the pos Z value and creates vehicles at ground level (Z=0) while the long version does not. Re: your question of being faster, I actually wrote that it's slower. Two selects will most likely be slower unless some compiler optimization happens in the future. --Zectbumo (talk) 17:29, 1 December 2015 (CET)
Maybe my confusion was I interpreted Killzone Kid's "the same" as "the same function" instead of "the same speed". I'll add a new entry focusing on equivalence.--Zectbumo (talk) 17:34, 1 December 2015 (CET)

Historic notes

Posted on Oct 18, 2009 - 05:42
As of Arma2, this command cannot be used to create game logics (source). Use createUnit instead.
Posted on August 13, 2006 - 12:18
Using main syntax of this command sets the created vehicle not exactly at the given position, you have to setPos it there, if accuracy counts.
Posted on Jan 20, 2006
Using main syntax of this command sets the created vehicle in the nearest possible position. You can create a dozen of tanks with it - they will appear side by side.