View Single Post
  #115  
Old 05-02-2012, 02:30 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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();
    }
Reply With Quote