Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #34  
Old 09-28-2011, 10:07 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

I found this somewhere a while ago and just changed the timer for the AIAircraft:

Code:
public override void OnTickGame()
	{
   double initTime;    
		
    if (MissionTimer1M1.Elapsed.Minutes >= 59) 
		{
		MissionTimer1M1.Restart();
		foreach (int army in GamePlay.gpArmies())
            {
                foreach (AiAirGroup group in GamePlay.gpAirGroups(army))
                {
                    if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) // Zeile L schen wenn auch AAA entfernt werden soll
                    {
                        AiActor[] members = group.GetItems();
                        for (int i = members.Length - 1; i > -1; i--)
                        {
                            (members[i] as AiAircraft).Destroy();
                        }
                    }
                }
               
    
			}
		}
	}
			
			//////////////////////////////////////////////////////////////////////////////////////////////////

    //Ground objects (except AA Guns) will die after 55 min when counted from their birth
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);
        if (actor is AiGroundActor)
            if ((actor as AiGroundActor).Type() != maddox.game.world.AiGroundActorType.AAGun)
                Timeout(3599, () =>
                {
                    if (actor != null)
                    { (actor as AiGroundActor).Destroy(); }
                }
                        );
    }
Note that you need to set the MissionTimer1M1 Stopwatch accordingly, f.e. in the OnBattleStarted-Section of you script:

using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
using System.Diagnostics;

public class Mission : AMission
{
Stopwatch MissionTimer1M1 = new Stopwatch();

public override void OnBattleStarted()
{
base.OnBattleStarted();

MissionNumberListener = -1;
}
...
..
.


I found some issues with removing of the AI Airplanes, but these will be removed after landing by the standard remove-Ai-after-player-leaving script, so I left it that way. For ground units it works well.
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:41 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.