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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2011, 09:00 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Exclamation Question for script guys? I want my AI to re-check their target's pos every 30sec

Hi guys,

You will see in my scripting I use many mixed scripts. But I notice on AI air units. That when they have long flights or targets set when they spawn. The Air target has moved from the area. So the plane gets there and circles.


I want my AI to re-check their target's pos every 30sec. Or just select next nearest Air unit every 30 sec. Any ideas???


Latest mission uploads here: http://forum.1cpublishing.eu/showthread.php?t=26096
__________________
__________________
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
  #2  
Old 09-25-2011, 10:27 AM
adonys adonys is offline
Approved Member
 
Join Date: Apr 2010
Posts: 850
Default

the idea would be to use dynamic flight paths..

ie have the code add new waypoints (with new eventually new targets) once the old waypoint is reached and the intended target was not there).. it's like ground control issuing new updated target positions and modify interception unit's path accordingly
Reply With Quote
  #3  
Old 09-25-2011, 10:56 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

Quote:
Originally Posted by adonys View Post
the idea would be to use dynamic flight paths..

ie have the code add new waypoints (with new eventually new targets) once the old waypoint is reached and the intended target was not there).. it's like ground control issuing new updated target positions and modify interception unit's path accordingly
Thanks Adonys,

My script already does that. When it reaches target it does some flying round then hunts. But I would like to alter the script so that during flight it alters waypoint to nearest target.

It almost needs a loop time script so that say every 60 seconds until it reaches its waypoint, that is searcers for closest enemy air target.
__________________
__________________
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
  #4  
Old 09-25-2011, 11:59 AM
adonys adonys is offline
Approved Member
 
Join Date: Apr 2010
Posts: 850
Default

I was saying exactly the same: you need to do that new waypoint assignment in real-time, during the mission (and not only at mission's generation). If I am remembering right, it was already done as a nexample in Cross Roundel mp map naarvy's script (in which he dynamically assigned new waypoints and targets to ground groups during the mission)..
Reply With Quote
  #5  
Old 09-25-2011, 08:42 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

I think onTickGame method should be used to repeat target pos checks every 60 seconds.
Reply With Quote
  #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
  #7  
Old 09-27-2011, 06:56 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Do you insert this into OnTickGame method?

Maybe you need to delete an old waypoint after the new one is created.

Checking every second (30 ticks ~ 1 second) could be too much load on server if you have many airgroups. I know that bombers look for targets within 5 km radius automatically. Probably fighters do at least the same. Therefore you do not have to adjust waypoint every second.
Reply With Quote
Reply


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 05:53 AM.


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