diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index ac5866fdb..d4a0f2dec 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -224,6 +224,7 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime ) if DCSControllable then local Controller = self:_GetController() + self:E(Controller) -- When a controllable SPAWNs, it takes about a second to get the controllable in the simulator. Setting tasks to unspawned controllables provides unexpected results. -- Therefore we schedule the functions to set the mission and options for the Controllable. @@ -419,7 +420,7 @@ function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, At -- AttackControllable = { -- id = 'AttackControllable', -- params = { - -- controllableId = Controllable.ID, + -- groupId = Group.ID, -- weaponType = number, -- expend = enum AI.Task.WeaponExpend, -- attackQty = number, @@ -444,7 +445,7 @@ function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, At local DCSTask DCSTask = { id = 'AttackControllable', params = { - controllableId = AttackGroup:GetID(), + groupId = AttackGroup:GetID(), weaponType = WeaponType, expend = WeaponExpend, attackQty = AttackQty, @@ -803,27 +804,28 @@ function CONTROLLABLE:TaskFollow( FollowControllable, Vec3, LastWaypointIndex ) -- Follow = { -- id = 'Follow', -- params = { --- controllableId = Controllable.ID, +-- groupId = Group.ID, -- pos = Vec3, -- lastWptIndexFlag = boolean, -- lastWptIndex = number -- } -- } - local LastWaypointIndexFlag = nil + local LastWaypointIndexFlag = false if LastWaypointIndex then LastWaypointIndexFlag = true end local DCSTask - DCSTask = { id = 'Follow', + DCSTask = { + id = 'Follow', params = { - controllableId = FollowControllable:GetID(), + groupId = FollowControllable:GetID(), pos = Vec3, lastWptIndexFlag = LastWaypointIndexFlag, - lastWptIndex = LastWaypointIndex, - }, - }, + lastWptIndex = LastWaypointIndex + } + } self:T3( { DCSTask } ) return DCSTask @@ -846,7 +848,7 @@ function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, E -- Escort = { -- id = 'Escort', -- params = { --- controllableId = Controllable.ID, +-- groupId = Group.ID, -- pos = Vec3, -- lastWptIndexFlag = boolean, -- lastWptIndex = number, @@ -855,15 +857,15 @@ function CONTROLLABLE:TaskEscort( FollowControllable, Vec3, LastWaypointIndex, E -- } -- } - local LastWaypointIndexFlag = nil + local LastWaypointIndexFlag = false if LastWaypointIndex then LastWaypointIndexFlag = true end local DCSTask - DCSTask = { id = 'Follow', + DCSTask = { id = 'Escort', params = { - controllableId = FollowControllable:GetID(), + groupId = FollowControllable:GetID(), pos = Vec3, lastWptIndexFlag = LastWaypointIndexFlag, lastWptIndex = LastWaypointIndex, @@ -947,7 +949,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, -- FAC_AttackControllable = { -- id = 'FAC_AttackControllable', -- params = { --- controllableId = Controllable.ID, +-- groupId = Group.ID, -- weaponType = number, -- designation = enum AI.Task.Designation, -- datalink = boolean @@ -957,7 +959,7 @@ function CONTROLLABLE:TaskFAC_AttackGroup( AttackGroup, WeaponType, Designation, local DCSTask DCSTask = { id = 'FAC_AttackControllable', params = { - controllableId = AttackGroup:GetID(), + groupId = AttackGroup:GetID(), weaponType = WeaponType, designation = Designation, datalink = Datalink, @@ -1055,7 +1057,7 @@ function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType, -- EngageControllable = { -- id = 'EngageControllable ', -- params = { - -- controllableId = Controllable.ID, + -- groupId = Group.ID, -- weaponType = number, -- expend = enum AI.Task.WeaponExpend, -- attackQty = number, @@ -1081,7 +1083,7 @@ function CONTROLLABLE:EnRouteTaskEngageGroup( AttackGroup, Priority, WeaponType, local DCSTask DCSTask = { id = 'EngageControllable', params = { - controllableId = AttackGroup:GetID(), + groupId = AttackGroup:GetID(), weaponType = WeaponType, expend = WeaponExpend, attackQty = AttackQty, @@ -1236,7 +1238,7 @@ function CONTROLLABLE:EnRouteTaskFAC_EngageGroup( AttackGroup, Priority, WeaponT -- FAC_EngageControllable = { -- id = 'FAC_EngageControllable', -- params = { --- controllableId = Controllable.ID, +-- groupId = Group.ID, -- weaponType = number, -- designation = enum AI.Task.Designation, -- datalink = boolean, @@ -1247,7 +1249,7 @@ function CONTROLLABLE:EnRouteTaskFAC_EngageGroup( AttackGroup, Priority, WeaponT local DCSTask DCSTask = { id = 'FAC_EngageControllable', params = { - controllableId = AttackGroup:GetID(), + groupId = AttackGroup:GetID(), weaponType = WeaponType, designation = Designation, datalink = Datalink, diff --git a/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.lua b/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.lua new file mode 100644 index 000000000..176f507c9 --- /dev/null +++ b/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.lua @@ -0,0 +1,24 @@ + +--Create Spawn Groups +local SpawnPlane1 = SPAWN:New("Plane 1") +local SpawnPlane2 = SPAWN:New("Plane 2") + +--Spawn Groups into world +local GroupPlane1 = SpawnPlane1:Spawn() +--local GroupPlane1 = GROUP:FindByName( "Plane 1" ) +local GroupPlane2 = SpawnPlane2:Spawn() +--local GroupPlane2 = GROUP:FindByName( "Plane 2" ) + +--Create Task for plane2 (follow groupPlane1 at Vec3 offset) (Note: I think I need to be using controllers here) +--i.e. cntrlPlane1 = groupPlane1.getController(groupPlane1) + +local PointVec3 = POINT_VEC3:New( 100, 0, -100 ) -- This is a Vec3 class. + +local FollowDCSTask = GroupPlane2:TaskFollow( GroupPlane1, PointVec3:GetVec3() ) + +--Activate Task (Either PushTask/SetTask?) +-- PushTask will push a task on the execution queue of the group. +-- SetTask will delete all tasks from the current group queue, and executes this task. + +GroupPlane2:SetTask( FollowDCSTask, 1 ) + diff --git a/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.miz b/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.miz new file mode 100644 index 000000000..cfd60b143 Binary files /dev/null and b/Moose Test Missions/Moose_Test_GROUP_TaskFollow/Moose_Test_GROUP_TaskFollow.miz differ