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
  #6  
Old 09-27-2011, 05:41 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default AI airgroups re-check their targets ever 34 seconds?

Hi guys,

Would this code look ok for making the AI airgroups re-check their targets ever 34 seconds?


Code:
	   /////////////////check ai air waypoints and set new task ever 34 sec.
	   
 	AiAirGroup airGroup = actor as AiAirGroup;
			if (Time.tickCounter ()% 34 == 0) / / 34 Ticks should be a second 
            if ((airGroup != null) || (1) || (2))
            {
                SetNewTask(airGroup);
                AiAirGroup[] eGroups = GamePlay.gpAirGroups((airGroup.Army() == 1) ? 2 : 1);
                if (eGroups != null)
                    foreach (AiAirGroup eGroup in eGroups)
                {
                        if (eGroup != null)
                    {
                            if ((eGroup.hasCourseWeapon()) && ((airGroup.isAircraftType(AircraftType.Fighter)) || (airGroup.isAircraftType(AircraftType.HeavyFighter))))
                        {
                                AiWayPoint[] chkWP = eGroup.GetWay();
                                bool res = true;
                                foreach (AiWayPoint eWP in chkWP)
                            {
                                    AiAirWayPoint aAWP = (eWP as AiAirWayPoint);
                                    if ((aAWP.Action != AiAirWayPointType.HUNTING) || (aAWP.Action != AiAirWayPointType.NORMFLY) || ((aAWP.Action == AiAirWayPointType.AATTACK_BOMBERS) && (aAWP.Target != null) && (aAWP.Target.IsValid())) || ((aAWP.Action == AiAirWayPointType.AATTACK_BOMBERS) && (aAWP.Target != null) && (aAWP.Target.IsValid())))
                                {
                                    res = false;
                                    break;
                                }
                            }
                            if (res)
                            {
                                SetNewFighterTask(eGroup, airGroup);
                            }
                        }
                    }
                }
            }
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
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 01:29 PM.


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