![]() |
|
|
|
#1
|
|||
|
|||
|
OK works great, however the spawning aircraft keep spawning
|
|
#2
|
|||
|
|||
|
I suspect the trigger "works" for every aircraft in a group. Had this issue in R2 mission, had to include in a script a variable TriggerOn = 1 every time trigger "worked" and then check if TriggerOn = 1 or = 0 regularly.
|
|
#3
|
|||
|
|||
|
You can use this script to avoid this:
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
AiAction Action = GamePlay.gpGetAction(shortName);
if (Action != null)
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
|
|
#4
|
|||
|
|||
|
Awesome!
Thanks guys for these postings! ~S~ |
|
#5
|
|||
|
|||
|
Thanks FG28_Kodiak looks good, ill try it out and see how it works.
|
|
#6
|
||||
|
||||
|
@Kodiak, I'm looking at the script you posted to nullify multiple spawn events:
Quote:
Hope its no trouble to ask, I'm just learning the ropes here.... cheers Freyah |
|
#7
|
|||
|
|||
|
You get the triggername via shortName.
So you can check the trigger with a if clause. OnTrigger(..) should look like: Code:
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("109".Equals(shortName))
{
AiAction Action = GamePlay.gpGetAction(shortName); // if your action has an other Name than your trigger change GamePlay.gpGetAction(shortName) into GamePlay.gpGetAction("ActionName")
if (Action != null)
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false; // if trigger is TPassThru to avoid multiple activation
return; // leave method to avoid second call of the Action
}
AiAction Action = GamePlay.gpGetAction(shortName);
if (Action != null)
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false;
}
|
|
#8
|
||||
|
||||
|
Thanks for the speedy reply !! I think I'm understanding it better now, will test it out soon! Can I do this over and over in the same script, to get the same effect for other triggers of the same type? eg 109 , Spit , 110 , etc.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|