Quote: "I thought it was only the last entity in the zone too, but it seems to actually be the highest entity number that gets returned."
Ok I have found a scenario where this occurs.
Say there is an entity in the zone that has a value of 10 and if another new entity enters the zone which has an value greater than 10, then this is detected. But if the value of the new entity is less then 10, then it is not detected.
Q. Is this what you guys are talking about or seeing ?
If so I will report it as a Beta bug, so it will get addressed.
Quote: "yh after a bit more testing it does seem to be the highest entity number only, i was hoping for a way to tell when a specific entity is in a zone and when he leaves but i dont think it's possible with the current command (it almost is but if anything with a higher entity number is in the zone it messes it up)"
@smallg
You got me thinking about the "i was hoping for a way to tell when a specific entity is in a zone and when he leaves ".
That would be handy. So I got it working. You just have to beware of the bug when setting up the map.
Map and script attached.
[UPDATE]
@all
I have been trying to create a function that will return weather an entity is within a particular zone.
I need help as I cannot work out how to do this. Any help would be great.
The array/table part is my problem that I just cannot work out.
Hopefully the below is clear and understandable.
-- this function is placed in the entity_zone.lua script
function CheckEntityinZone(e)
-- Im trying to work out how you could make a command like the following, that you could call in the ai_soilder script for each ai.
-- you would do this check in the ai_soldier script.
if zone_name[entity_inzone_flag[entity_number_inzone[e]] == 1 then
-- then enity is in the zone_name
end
if zone_name[entity_inzone_flag[entity_number_inzone[e]] == 0 then
-- then enity is not the zone_name
end
if
-- variables to work with
zone = {}
zone[n] = {}
e=zone_number[e]
n=zone_name[e]
f=entity_inzone_flag[e]
i=entity_number_inzone[e]
v=0
w=1
-- so return something like this.
-- zone_name[e]['entityinzoneflag'] = 1
-- zone_name[e]['entityinzoneflag'] = 0
--zone
if n ~= nil then
if i ~= nil then
if f ~= nil then
if entity_inzone_flag[e] == 1 then
-- then return zone_name[e]['entityinzoneflag'] = 1
else
-- then return zone_name[e]['entityinzoneflag'] = 0
end
return
end
end
end
--EXAMPLE SAY:
entity_number_inzone[e] = 34 -- this is the soldier
entity_inzone_flag[e] = 1 -- the soldier is in the zone
zone_name[e] = Eastern Zone -- the name of the zone
zone_number[e] = 10 -- the entity number of the zone
zone_name[e][entity_inzone_flag] = 1
if zone_name[entity_number_inzone][entity_inzone_flag] == 1 then
--34 is in zone 10
else
--34 is not in zone 10
end
end
Cheers
Desktop: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528.
Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)