Page 1 of 1

object in sight

Posted: 15 Jan 2018, 14:19
by Prot
I want to ask, if we have the opportunity to receive information, does one player seen object to another player?
At the moment I see only one solution. enumStruct/Droid/Whatever(player, type, view), but it requires a lot of cycles if I need reverse to find out whether the object in view, or under the fog of war one player by another.
I'm not very strong in qtscript functions, is it difficult to do such a function to the JS API isSight(object, who_sight)?

Re: object in sight

Posted: 15 Jan 2018, 19:00
by Per
I'm not entirely sure what you're asking. enumStruct and enumDroid both have an optional third parameter that filters the list of droids by the vision information of the player parameter passed in. Other functions have similar filters.

Re: object in sight

Posted: 16 Jan 2018, 06:40
by Prot
Per wrote:I'm not entirely sure what you're asking. enumStruct and enumDroid both have an optional third parameter that filters the list of droids by the vision information of the player parameter passed in. Other functions have similar filters.
With the increasing of code in my bot, i have to think about optimizing more and more.
For example: eventObjectSeen we saw strategically important objects memorized in a array. Next, we need to know if you can see it or whether anyone from this array or not. Of course you can just query the object and get its coordinates etc, this API allows you to do, whether we see the object or not, but it's something like cheating. And I all the details I want to make a bot without the advantage over man.
Therefore is to ensure that the object in view, we need to interrogate all the objects through the filter enum...(obj,type,VIEW) with the third option, and that's a lot of cycles through the obj.filter(), or obj.forEach() etc.

Re: object in sight

Posted: 17 Jan 2018, 00:33
by Per
For script performance, you should try to use enumArea() and enumRange(), as they iterate over fewer objects.

Re: object in sight

Posted: 17 Jan 2018, 05:34
by Prot
Ohh.. Right. I still don't have the habit to consider code under the v3.1.5