i guess the quotes in the if then line are mistakes.
Nope, they're required because of _x forEach stuff.
Alright, the script seems to be ok at a first look
hehe i always find the monkeys during the second look
*laughing-devil-smiley*
There's one thing, you could still change (well in summary it's
two things, but it's both the same):
?(_unit == civ1): _cararray = civ1cars
?(_unit == civ2): _cararray = civ2cars
?(_unit == civ3): _cararray = civ3cars
?(_unit == civ4): _cararray = civ4cars
?(_unit == civ5): _cararray = civ5cars
?(_unit == civ6): _cararray = civ6cars
?(_unit == civ7): _cararray = civ7cars
?(_unit == civ8): _cararray = civ8cars
?(_unit == civ9): _cararray = civ9cars
?(_unit == civ0): _cararray = civ0cars
and the second one:
?(_unit == civ1): civ1cars = _removearray
?(_unit == civ2): civ2cars = _removearray
?(_unit == civ3): civ3cars = _removearray
?(_unit == civ4): civ4cars = _removearray
?(_unit == civ5): civ5cars = _removearray
?(_unit == civ6): civ6cars = _removearray
?(_unit == civ7): civ7cars = _removearray
?(_unit == civ8): civ8cars = _removearray
?(_unit == civ9): civ9cars = _removearray
?(_unit == civ0): civ0cars = _removearray
This could be changed into a one-liner by using the if-then technique +
an array, containing sub-arrayshmm - just noticed it's already early in the morning, and if i
would continue with what i was going to show you, i would
have to type at least one hour (including checks + correction
of meself - duh).
In case of your actual script it's anyway easier to use the method
you already made, as it's just about 9 extra lines, you having here.
Just a quick explanation of what i meant, so that we can continue
that later if you're interested and if i got enough time left.
Maybe it will sound a bit complicated now, but believe me, once
you get it, you're becoming an MOA (master of arrays)
you would have to create a major array, where you put all units
+ their affilated arrays into;
like that:
;first the minor arrays
civ1array = []
...
...
civ0array = []
;now the major array
civ_all_array = [[civ1,civ1array],[...and_so_on...],[civ0,civ0array]]
Instead of doing the ?(_unit == civX):_cararray = civXarray
seperately, you could now do it that way:
"if (_x select 0 == _unit) then {_cararray = _x select 1}" forEach civ_all_array
:note - each subarray of civ_all_array consists of a subarray, which again consists of a unit and an array (you still there? - lol)
Let me explain it straight and short;
If _unit would be civ3, then _cararray would be civ3array
_x represents the subarrays of civ_all_array
_x select 0 represents civ1 - civ0
_x select 1 represents civ1array - civ0array
btw - why did i say i ain't got enough time left right now, if i
do it then though? - Yeah it's because i like this brainburning
stuff in the morning sooo much ;D
OK, now the stuff, needed to cut down the second part into
a one-liner.
:note - the next line is to be kept like it is, i'll just post it to
keep in mind where we are in the script now;
if (_x != _vehic) then {_removearray = _removearray + [_x]} forEach _cararray
After succesfull removing the car from _cararray, you need to
put it back into your major array. This is a bit more tricky now,
as you will need a new command for that:
array set [pos,stuff]:note - pos is the position in the array and stuff is what you want
to put(replace/exchange) in there.
"if (_x select 0 == _unit) then {_x set [1,_cararray]}" forEach civ_all_array
It's the same technique, being used above with the only difference that we're using ARRAY SET stuff.
_x represents the subarrays of civ_all_array
_x select 0 represents civ1 - civ0
_x select 1 represents civ1array - civ0array
If _unit would be civ3, then civ3array would be replaced by _cararray.
OK, think that's all for now - wish you sweet dreams of arrays
and subarrays and civies and their civXarrays too ;D
If you got any questions - no prob - i'm off work this week, but
not me mrs (*lol it's only my pc's and me in da house*)
It may look again a bit more complicated now, but trust me, it's
worth the effort to get familar with that - way more doors will
be open in ofp for your.
~S~ CD