Your error:
if (SaidToGroup == true) return;
you leaving the method, but i think you will only leave the foreach, so you must use:
if (SaidToGroup == true) break;
and g.candidates() returns AiAirGroup[] so you should use GetItems() to get the Actors.
Corrected code:
Code:
private void sayMessageTo(int army, string msg)
{ // send a speech message to all players in specified army (1=red; 2=blue)
foreach (AiAirGroup g in GamePlay.gpAirGroups(army))
{
bool SaidToGroup = false;
foreach (AiActor a in g.GetItems())
{
if (SaidToGroup == true) break; // speech already said to group
SaidToGroup = true;
(a as AiAircraft).SayToGroup((a as AiAircraft).AirGroup(), "Ready_for_takeoff"); // for testing only
//a.SayToGroup(a.AirGroup(), msg);
}
}
}