![]() |
#23
|
|||
|
|||
![]()
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); }); } } Code:
AiAction action = GamePlay.gpGetAction(shortName); if (action != null) action.Do(); 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(); } |
|
|