Quote:
Originally Posted by FG28_Kodiak
the orginal OnTrigger is defined in the Battle-Script:
Code:
public virtual void OnTrigger(int missionNumber, string shortName, bool active)
{
if (this.missions.Count > 0)
{
foreach (AMission mission in this.missions)
{
if (mission.IsMissionListener(missionNumber))
{
mission.OnTrigger(missionNumber, shortName, active);
}
}
}
else if (active)
{
AiAction action = this.GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
}
}
If you override the OnTrigger - Method, you create a empty new method so the ability to spawn Airgroups etc is lost, this is nessesary to avoid side-effects.
So to get the old behavior you must insert code to spawn the Actors again for example with:
Code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
}
|
Let's see if I understand you correctly Kodiak...
First of all, you mention "the battle script" and even present the OnTrigger virtual method. Is the AMission class source code available somewhere?! If so, where can I find it?
You then say...
Quote:
Originally Posted by FG28_Kodiak
If you override the OnTrigger - Method, you create a empty new method so the ability to spawn Airgroups etc is lost, this is nessesary to avoid side-effects.
|
If I override the OnTrigger i can add base.OnTrigger(...), which of course would be quite useless, but my experiments indicated that overriding OnTrigger is mandatory, like bolox said, to allow actions to actually be triggered, right?
In your override you check for 'missions' (if (this.missions.Count > 0)). Are those "sub missions" loaded by "this" mission?
You then iterate those missions and calls their OnTrigger(), but only if they are "mission listeners". What is that?
Then, if there's no (sub?) missions you move ahead and actively checks for any action to be triggered and calls its .Do() method if the trigger is active which makes sense of course but why is this done only if there's no (sub?) missions? Is this to allow those (sub?) missions to make the ultimate decision to act on the trigger or not?
Finally, you present an override that starts with calling the default behavior. But then it goes ahead and forces the affected action to trigger regardless. Why is that?
Thanks for taking the time mate!