Jump to content

Attack Order for Spawned Assets (Moose)


Kyridious

Recommended Posts

Does anyone have an example mission demonstrating how to task a spawned AC to attack another spawned AC? I thought I had this working a long time ago (1.5) but I have not been able to get it to work in 2.1 / Normandy.

 

I've tried a bunch of variations along the lines of ...

 

[font=Fixedsys]local sg1 = SPAWN:New( "FW190" ) 
local sg2 = SPAWN:New( "P51D" ) 
local g1  = sg1:SpawnFromVec3(Vec3)
local g2  = sg2:SpwanFromVec3(Vec3)
g1Name    = g1:GetName()
g2Name    = g2:GetName()

// Delay X seconds using a SCHEDULER to allow time for the 
// sim to create controllers for the newly spawned groups, 
// then task g1 to attack g2

local g1     = GROUP:FindByName(g1Name)
local g2     = GROUP:FindByName(g2Name)
local myTask = g1:TaskAttackGroup(g2)
g1:SetTask(myTask,1)[/font]

The usual outcome is:

1] Assets spawn normally

2] Any default tasking for sg1 (as defined for the spawn group in the ME) is discarded / overwritten (indicating that _something_ is happening)

3] g1 ignores attack group command

 

Cheers!

Andrew

Link to comment
Share on other sites

Hello, give this a try

 

P51group = GROUP:FindByName("P51D")
P51spawn = SPAWN:New( "P51D" ):Spawn()
FWspawn = SPAWN:New( "FW190" )
:OnSpawnGroup( 
       function (SpawnGroup)
	Task = SpawnGroup:TaskAttackGroup( P51group )
	SpawnGroup:PushTask(Task, 5)
       end
   )
:Spawn()


Edited by RAF_Raven
Link to comment
Share on other sites

Thanks Raven.

 

 

I was able to make both our approaches work last night in a barebones mission with distant targets. More testing is required, but I suspect things begin to break down if the AC are spawned & tasked within detection distance of each other. Perhaps it has to do with threat level? (Not sure how AI interpret client threat level).

 

 

Regardless, I'll update this thread as I learn more.

 

 

Cheers

Link to comment
Share on other sites

  • Recently Browsing   0 members

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