![]() |
|
#1
|
|||
|
|||
|
I am trying to remove the AI which was loaded via submission with the script of the submission. The submission is lasting max. 3hrs then a new missions will be laoded. I use the following for removal of the AI planes
Code:
public override void OnTickGame()
{
double initTime;
if (Time.tickCounter() % 324000 == 323999) // 180mins
{
foreach (int army in GamePlay.gpArmies())
{
foreach (AiAirGroup group in GamePlay.gpAirGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber))
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiAircraft).Destroy();
}
}
}
foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber))
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiGroundActor).Destroy();
}
}
}
}
}
}
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
if (actor is AiGroundActor)
{
Timeout(324000, () => { // nach 180minuten werden AI entfernt
if (actor != null)
{
(actor as AiGroundActor).Destroy();
}
});
}
}
The mission with this script will be loaded into the main map after 1minute, so the 324000 ticks should acutally be far away?
__________________
http://cornedebrouwer.nl/cf48e |
|
|