With the new AI debugging tool I logged all the messages. I noticed the mother is sending and receiving them. The defenders however never get it. So i looked into the code of the command and saw that if the carrier has no groupID itself, it never sends anything to its members. And again with the debuggingtool I noticed that the carrier groupID is 0. (=NO_GROUP). This means there is a bug in the ship-adding routine. The populator sets groupID but ships added by script don't have it.
Code needs a fix. Or in the adding it should check if it is an carrier or in the launching of defenders there must be a check for the groupID of the mother. The defenders itself have a groupID set.
For the time being I added a sendScriptMessage that sends a "GROUP_ATTACK_TARGET" to all group members. Now the group members act as intended and abort their docking and go into attack mode.
Code: Select all
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget, "sendScriptMessage: groupAttack");
Code: Select all
this.groupAttack = function()
{
// create an array of all defense_ships in a radius of 30000 m around the ship
let thargoidDefenders = system.shipsWithPrimaryRole("defense_ship", this.ship, 30000);
// send message to those defenseShips that are group members.
for (let i=0; i<thargoidDefenders.length; i++)
{
// if the ship is a groupmember
if(thargoidDefenders[i].groupID == this.ship.ID)
// send the message to the AI
thargoidDefenders[i].reactToAIMessage("GROUP_ATTACK_TARGET")
}
}