Jump to content

Problem with LUA tasking


catt42

Recommended Posts

Hello everybody,

 

I'm getting a few unexpected AI behevior when issuing tasks with LUA. As an example, I wrote this simple script to order "a01" to orbit over a trigger:

 

function orbit_task(unit, zone_name, orbit_speed, orbit_altitude)
orbit_zone = trigger.misc.getZone(zone_name).point
orbit_point = {x = orbit_zone.x, y = orbit_zone.z}
	local orbit = {
	id = 'Orbit', 
		params = { 
			pattern = 'Circle',
			point = orbit_point,
			speed = orbit_speed,
			altitude = orbit_altitude,
		} 
	} 
unit:getController():pushTask(orbit)
end

orbit_task(Unit.getByName("a01"), "orbit_zone", 145, 4000)

 

 

In the attached mission, the code is executed after 10 seconds. After 120 seconds I order the aircraft to switch back to waypoint 1, using the in-editor AI TASK PUSH command.

 

The aircraft execute the first command and start orbiting, but the second command has no effect. I tried AI TASK SET, and it doesn’t make a difference.

 

I also tried getController():popTask(), which has no effect, and getController():resetTask(), which sends the aircraft to the closest airport.

 

 

Can anybody help me?

lua_task_test.miz

Link to comment
Share on other sites

:book:


Edited by edokg



[sIGPIC]https://forums.eagle.ru/signaturepics/sigpic128931_4.gif[/sIGPIC]

 

SO:Win10 64bit CPU:Intel i7 8700K@3.7 RAM:DDR4 46GB G.Skill Trident 3200MHz CL14 GPU:Nvidia EVGA GTX1080Ti FTW iCX MB:ASRock Z370 Extreme4 HDD:

512GB Samsung 970 PRO SSD M.2 NVMe + 250GB Samsung 850 EVO SSD + 2x500GB Seagate Barracuda 7200RPM

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...