targetsQuery – Talk
No usage notes... anyone know how to use this?
This thread has some info taken from FSMs. I did some playing with the parameters but only found a difference in results so far if I change the "speaker".
_retval = player targetsQuery ["","","","",""];
in my test returned an array with 19 entries (I'm a civilian watching some OPFOR guys). The returned set was different depending on which "speaker" I used, e.g. a helo hovering far away returned no results, as expected. Each element of the returned array looks like this:
[1, O 1-2-C:1, EAST, "Ins_Soldier_AT", [9917.05,5473.62], -0.14]
The 2nd element is the unit being referred to, and you can use that for further information about the unit. The rest presumably is what the AI "thinks" about the unit. Side and unit type are obvious. My knowsAbout level for all units returned was > 0, so presumably it is only returning units I know about (there are additional units in the game world which are too far away for me to have a hope of seeing).
The 2D position seems close to the actual position. Here's a few examples:
[1,objective1,EAST,"Ins_Soldier_CO",[9904.85,5461.77],109.951]
Player knowsAbout: 2.72977
Position: [9894.17,5392.15,-0.088501]
This is an insurgent officer (named "objective1" in the editor) placed in a building. He's behind a wall and I don't have LoS on him, so my character shouldn't know where he is. Holding space and scanning where I (as the mission creator) know he's located doesn't show him up. However it gets interesting: I've often seem this guy standing in front of the building, even though he's not meant to (some kind of bug I haven't worked out yet). I looked for him there and he's not there, BUT: my cursor says "Officer" as if he is. So I walked down there and looked into the building, and saw the officer where he's meant to be. Re-ran the targetsQuery and voila:
[1,objective1,EAST,"Ins_Soldier_CO",[9894.21,5392.18],-0.391]
Player knowsAbout: 4
Position: [9894.17,5392.15,-0.088501]
So as you can see, my knowledge of him was previously 2.7 and the known position was way off (the guy is setPos'd at mission start, but his editor-placed position is visible from my character's position, so perhaps he's remembering that?). Once I regained eyes-on, the position returned by targetsQuery was spot on.
[1,O 1-2-C:1,EAST,"Ins_Soldier_AT",[9917.05,5473.62],-0.14]
Player knowsAbout: 4
Position: [9917.07,5473.66,0.00143433]
[1,Agent 0xf5e4c00,CIV,"Rabbit",[10013.2,5415.29],-0.14]
Player knowsAbout: 0.0451425
Position: [10016,5415.64,0.0019989]
The rabbit was generated by game (no ambient creatures module either).
[1,O 1-2-E:1,EAST,"Ins_Soldier_AR",[9881.69,5463.57],-0.14]
Player knowsAbout: 4
Position: [9881.73,5463.61,0.00135803]
[1,O 1-1-F:1,EAST,"Ins_Soldier_2",[9913.33,5466.72],109.951]
Player knowsAbout: 2.32887
Position: [9905.61,5428.34,-0.0885315]
Again, a knowsAbout level of 4 gives me perfect knowledge of his location, but 2.x is out by a little bit.
Current unknowns:
- What are valid values for the rest of the parameters?
- What is the first element of the info array? (seems to always be 1)
Current speculation:
- The sixth element seems to be the time since the "sender" last saw the unit. I can repeatedly make this go up by moving out of the guy's line of sight, and make it reset to a negative value by moving back to within his LoS.
--nomdeplume 19:08, 31 December 2009 (CET)