Only if OnTrigger is overriden if not you dont need to add the action part, in the script i use OnTrigger to detect the destruction of a radar via trigger.
Code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.StartsWith("Radar") && shortName.EndsWith("Destroyed"))
{
GamePlay.gpLogServer(null, "Radar destroyed", null); //testing only
Headquarters.ForEach(item =>
{
item.SetObserverInactive(shortName);
});
}
}
So if you use Actions you must add
Code:
AiAction action = GamePlay.gpGetAction(shortName);
if (action != null)
action.Do();
to get them to work.
So the Ontrigger should look like:
Code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.StartsWith("Radar") && shortName.EndsWith("Destroyed"))
{
GamePlay.gpLogServer(null, "Radar destroyed", null); //testing only
Headquarters.ForEach(item =>
{
item.SetObserverInactive(shortName);
});
}
AiAction action = GamePlay.gpGetAction(shortName);
if (action != null)
action.Do();
}