安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
e.g
Let's take the command weapons[community.bistudio.com]. There you can see that the return value an array of worn weapons from the unit is.
And that's in general the magic behind the "select". The number behind the select is the index that is chosen from the array/return value.
Select 3 and select 4 in this instance are explained here: https://community.bistudio.com/wiki/nearTargets
The script is pulling information from the array returned by the nearTargets command, see Nobodys description above regarding arrays :-)
The _x preceding the selects represent information regarding one of the Possible Targets (_possTar) if any, during each iteration of the forEach loop.
_x select 0 = Objects Position
_x select 3 = Subjective Cost
_x select 4 = Object
Hope thats makes sense :-)
I would say a bit of both.
Looking at the code I seen the forEach _possTar, then I looked at what information _possTar holds, that being nested Arrays containing info on Targets within a _maxDistance (which will be defined further up in the script) from the _unit.
One of the best pieces of advice I could give is to always read what the return value of a command is.
Using the Wiki example for the return value nearTargets:
[**[[2555.33,2535.33,1.32708],"SoldierEB",EAST,214222,EAST 1-1-A:1]**,
**[[2550.39,2482.5,1.32696],"SoldierWB",WEST,0,WEST 1-1-A:2]**]
The array in between the first ** (I added the ** to split the nested arrays) will be first selected array on the first run of the forEach loop followed by the next (There maybe alot more depending on targets in distance), each of the nested arrays hold all the info on a particular object which you can pull using the select command.
First run of forEach _possTar
_x select 0 would be [2555.33,2535.33,1.32708] the objects Position. (Position is an array)
_x select 1 would be "SoldierEB" the Objects classname. (Classname is a "string")
etc
Second run of forEach _possTar
_x select 0 would be [2550.39,2482.5,1.32696]
_x select 1 would be "SoldierWB"
etc
By doing this you can use the return values for other commands such as aimedAtTarget.
The aimedAtTarget requires the following:
vehicle aimedAtTarget [target, weapon]
So a vehicle, a target, and a weapon.
The script uses _unit for the vehicle (defined further up the script).
_x select 4 is the Object (target) pulled from a nested array within the _possTar array, remembering that _x represents the first nested array in the first run of the forEach loop then the second nested array in the second run and so on.
And finally a weapon which is the "autocannon_35mm".
And so,
_unit aimedAtTarget [_x select 4,"autocannon_35mm"];
******************************************************************************************
To provide a further example of nested arrays:
Again hopefully that made sense to you and I didnt just waffle on.