![]() |
Use OnTickTime to re-evaluate AI air group waypoints
Hi,
I have good coding where AI planes on spawn will locate an enemy location and fly to it and attack. The problem is. If the enemy is a plane. By the time the AI reach their waypoint where they are to attack. the enemey planes have of course flowen away. What is the best code to insert that will have the AI check their current waypoint to reset if the target has moved to new location or if there is a closer enemy they decide to attack? Code:
public override void OnTickGame() Below are the two Waypoints I want the AI to check every minute. Code:
public override void OnMissionLoaded(int missionNumber) |
I am very interested in this subject, due to the fact that I use a similar "AI find your target yourself" script on our server. It works so far quite well, but a routine, which would set the intervall the AI searches for new targets and sets their new tasks accordingly would be really good.
I have at the moment other irons to hammer, but if you find a solution, please drop a line. ;) PS: I used Naryvs approach, had no time to compare it with yours, but you find the code below: Code:
using System; |
I was planning to work on something like this myself too, using narvy's example, for the WIP Mission Tools.
Is a ugly way to overwrite, and thus make a dirty fix, with the current broken AI behavior (I've seen countless times AI flights passing by each other with less than 500 m between them, and giving no sign they've seen each other), until we'll get some AI from MG.. |
Yes we are using the same code in a way. But in my actual scripting (not above here) I meshed in AI ground vehicles also. Now the AI ground are fine and do an update and check on their targets and pathway every 5 mins and that is great.
But yes there was a small bit of code that set off the AI Air find targets etc.. then ai air groups would (just like real pilots) look around them and alter their targets based on current situation. As for AI not attacking. I read something and did some testing. Looks like AI will not attack (at the moment) if their group is smaller then the Air target or if their awareness is lower than ace. So if you are on your own and two or more 109's are near they will attack. But if you are equal 1:1 or you have more fighters in group they just ignore you. Will all be fixed I am sure in later patches |
I did some experiments on that subject some month ago. The main problem is that you cannot change the existing waypoint objects, this means you have to create and assign new waypoint objects (that include the updated target position). Now the problem is that you cannot simply clone all waypoints of the air group, update the position of the "attack" waypoints with the current target position and then assign them again, because the air group would turn around and fly back to their first (takeoff) waypoint and start all over.
|
I have 2 solutions in my mind:
a) I followed this approach during my experiment. I only assign the next waypoint to the air group. I react on the OnActorTaskComplete event to assign a new waypoint for the air group. After the takeoff waypoint I assign an attack waypoint on the target position. I adjust the position of the attack waypoint periodically. After the attack waypoint was completed a landing waypoint is assigned. Did work pretty good to lead the air group to the target, however updating the waypoints interrupted the current task of the air group (they stopped attacking or crashed during takeoff). b) I need to find out which waypoints were already passed by the air group. When I assign the updated waypoints I only assign waypoints that were not passed so far. I have so far no solution to find out which waypoints were passed. Triggers could be a solution or a smart algorithm that looks at the position and heading of the air group. I will look at the issue in a couple of week as I'm currently busy with implementing the online support and moving frontline/ground war for IL2DCE. |
Banks I agree with Part a) as sounds good. I will let you go as you work on DCE.
If you are able to. Could you email me the one or both test mission scripts so I could take a look while you are working on DCE for a couple of weeks. Or post the two test missions up on here. if not that's ok. HC_Wolf@optusnet.com.au |
Quote:
|
Hi, I came across this script for Radar and Tracking. Anyone care to take a stab at this and converti it so it is AI updating thier waypoints to re-evaluate their targets position and thus re-assign to the targets new location?
http://translate.googleusercontent.c...ce_VHHDnwatyyw |
Quote:
how exactly does the AI behave differently with than without the script??? how can i imagine that? if i set waypoints for a AI group, will they act spontaniously when they get in the surrounding of enemies, and ignore there waypoints? or will they know automatically where all enemies are on the map, when they get spawned, and fly to that point? |
All times are GMT. The time now is 11:22 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.