SubVision Posted March 16, 2017 Posted March 16, 2017 I tried make script that writes a message when rocket are approaching to players plane. To do this i tried to use function Weapon.getTarget(), when rocket were flying to aircraft. This returned nil, but missile were aiming at plane(there were no other weapons). Code: local unit=Group.getByName(env.getValueDictByKey(group.name)):getUnits()[1] local foundWpns = {} local volS = { id = world.VolumeType.SPHERE, params = { point = unit:getPoint(), radius = 5000 } } local ifFound = function(foundItem, val) foundWpns[#foundWpns + 1] = foundItem return true end world.searchObjects(Object.Category.WEAPON, volS, ifFound) return foundWpns[1]:getTarget()
Recommended Posts