Jump to content
Sign in to follow this  
zapat

What affects "doMove" path?

Recommended Posts

My problem is the following:

I am working on a bomb run script:

Plane gets spawned, then fly towards target, if there: drop freefall bomb.

For accurate bombing the plane needs to fly in a straight line. Therefore I set its direction, give it velocity, disable pilot's target, autotarget, set careless&blue, and finally give it a doMove order.

Now it works fine, even if there are enemy units in the path. Until!!

Until a plane that got shoot at can fly some more... :) (this is the only observation, really.)

After that the next (and all future) spawned planes go off the straight line, and take a detour...

What can cause this? Is it in connection with the enemy being revealed to the future planes by the plane that survived?

Is there a way or workaround to turn this off?

The problem is not this, but the planes stay on their detour path even if the enemies are destroyed... Once they start going off the straight line, there is no way to make them return...

Share this post


Link to post
Share on other sites

probably an error in the way you are "moving" the plane in the script.

if you post it it will be easier to say, also are you using specific names or local names in the script?

Share this post


Link to post
Share on other sites

Ok, here is a striped down version of the script, with only the minimal parts that are necessary to see my problem. I wrote this like from scratc, but the effect is the same. How could I tell them to stay straight?

How you can see it:

-get an empty area (airfield)

-place a civil player somewhere there

-place a Tunguska between the player and the plane (use _direction)

-spawn like 5 planes after each other, so some can get through Tunguska (I use addaction)

-wait like 5-10 secs after a survivor passes above you

-spawn again: they will go detour instead of straight line.

private ["_vehicle","_direction","_side","_spawnDistance","_altitude","speed","_speedms","_rDir","_targetPos","_spawnPos","_HeliCrew","_Huey","_pilot","_wait"];

// ****** VARIABLES
_vehicle = "A10";
_direction = 220; //direction @ Chernarus airfield with good view
_side = west;
_spawnDistance = 1500; 
_altitude = 60;
_speed = 200; 

_speedms = _speed / 3.6;
_rDir = _direction + 180;
if (_rDir > 360) then {_rDir = _rDir - 360};

// ****** SPAWNPOS
_targetPos = position player; 
_spawnPos = [(_targetPos select 0) + sin _direction * _spawnDistance,(_targetPos select 1) + cos _direction * _spawnDistance,_altitude];

// ****** CREATE PLANE
_HeliCrew = creategroup _side;

_Huey = ([_spawnPos, _rDir, _vehicle, _HeliCrew] call BIS_fnc_spawnVehicle) select 0;
_Huey setVelocity [sin _rDir *_speedms,cos _rDir *_speedms,0];

_pilot = driver _Huey;

_pilot disableAI "TARGET";
_pilot disableAI "AUTOTARGET";  
_HeliCrew setCombatMode "blue";
_HeliCrew setBehaviour "careless";

// ****** FLYIN
_Huey flyInHeight _altitude;
_pilot doMove _targetPos;

//*******WAIT UNTIL @ TARGET
_wait = true;
while {_wait} do
{
   _Huey limitSpeed _speed + 20; //limit speed (works only in loops)

   if (_Huey distance player < 200) then
   {
       _wait = false; //we are @ targetPos, exit loop
   };
   sleep 1;
};

// ****** WAIT and DELETE
sleep 20;

deleteVehicle _pilot;
deleteGroup _HeliCrew;
deleteVehicle _Huey;

BTW: I am using local names, most of the things are spawned in the mission. I am using private, and making it a function, so that part is okay. Without the tunguska I can spawn unlimited planes without any wandering off.

Edited by zapat

Share this post


Link to post
Share on other sites

well, doMove: after domove is issued to a unit, the unit goes into default beheaviour, meaning aware and full or normal and normal engage routines.

This will lead for example A10s to go 5 km out to come around and engage spotted targets, dont think domove negates disableAI commands.

to make unit beheave differently, eg careless, stealt, hold fire etc. these orders have to be issued after the doMove command to take effect.

limitspeed: use sleep 0.1 instead of sleep 1 to have proper effect.

also i use if ((_Huey distance player) < 200) then

instead of if (_Huey distance player < 200) then without () around the distance part, one condition, but it may work fine as is.

I see no obvious faults exept the above, will try a test later on.

Share this post


Link to post
Share on other sites

I use sleep 0.1 in my real script. Anyways, speed is kinda good with 1 sec as well.

I don't think brackets count in this expression. That part works okay.

I checked behaviour and it stays careless and blue for the whole time. Both straigth and detour planes. Other than this the plane doesn't engage the tunguska. It doesn't even fire at it... Only that detour. :)

Thanks for taking a look into it though.

Share this post


Link to post
Share on other sites

No problem mate, its trial and error scripting for arma.

you delete the group after 20 secs of reaching within distance of player... maybe AI is dumbed down when deleting group, look into when it deletes the group perhaps...

Maybe plane is flying on auto pilot with no pilot x) or something...

when trying new scripts i place a _testnr = 0; at top and

_testnr = (_testnr + 1);
hint format["%1",_testnr];

after each line to check where it errors out if at all..

you will see 1,2,3,4 etc and will easily locate bugged part if any or see when and where what activates.

also since i use arma edit for my scripting, its very easy to remove all hints after by replacing them with nothing ;)

Edited by Demonized

Share this post


Link to post
Share on other sites

I tried like a thousand things already... :) Deletes does not affect outcome.

Problem is that there is NO error. Everything gets executed the way it should, only the path taken is different. Only observation that planes alter the path ONLY AFTER one got hit...

Thats why I started wondering about the AI's knowsabout. Whether a careless pilot's path was affected by enemy units on his possible paths...

I just don't have any experience at all in that field and I hoped someone comes and gives me a magic command for turning that off. :)

Edited by zapat

Share this post


Link to post
Share on other sites

I've had the same problem when working on a CCIP for dumb bombs. The only plane that will fly directly over the target is the first one created.... everyone after that fly's around the target to the left or right. I eventually gave up trying!

If someone can figure this out it would be great. There are a lot of threads in the forums about "CARELESS" not actually meaning careless. The AI still seem to react as they please.

Share this post


Link to post
Share on other sites

Bad news...

twirly: what does "first one created" mean for you? What if the target changes? First one after a load? Or does it mean one per mission init?

It works okay for me if the planes don't get shot at... So probably they try to avoid hot spots even in careless.

Question is: how do I know if the pilot has a "hot spot"?

Share this post


Link to post
Share on other sites
twirly: what does "first one created" mean for you? What if the target changes? First one after a load? Or does it mean one per mission init?

I made a test mission with continuously respawning planes so I could test the CCIP code I was playing with. I wanted the AI to bomb some vehicles, troops...whatever.... fairly accurately using dumb bombs. I'm creating the bombs under the wings at the same velocity and direction as the plane.

It would work exactly one time. Every plane spawned after the first one seems to magically know that the target is there and try to take an evasive path around it. Not good for free fall bombing!! The bomb would always be released off to the side of the target as the pilot veered away.

I've had the same trouble with trying to make CIVILIAN's ignore their surroundings and just follow the script! Every time there is action anywhere near them they just hit the ground.... jump out of their car etc.

It's real annoying when every single command you try for this just does not work.... and there's enough of them..... disableAI.... careless etc.

EDIT: As far as I know ... you've done everything here that you can do... except maybe setskill. But that seems to do eff all as well.

_pilot disableAI "TARGET";
_pilot disableAI "AUTOTARGET";  
_HeliCrew setCombatMode "blue";
_HeliCrew setBehaviour "careless";

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

try this for test, spawn 1 plane let him find the enemy and get fired upon or whatever, as long as he knows its there, then wait 5 minutes and try a new spawn same thing.

If it works fine now, this means the knowsabout level broadcasted to side is overriding all other commands, and there can be made workarounds and or reported as a bug ticket to BIS if not reported already.

knowsabout will stay at its highest for a few minutes after enemy is detected after loss of sight.

Share this post


Link to post
Share on other sites

I think it's a bit buggy. Newly created AI seem to know an awful lot about their surroundings. Since "CARELESS" does not work the way it used to (years ago).... the workaround should be the disablAI commands... which should at least do what their names suggest.

There also was a time that CIVILIANS just ignored everything and you could put them to fly/drive these vehicles to accomplish these tasks.

Share this post


Link to post
Share on other sites

a delete/spawn replacement enemy will also work as nobody will know nothing about it.

depends on your goal, but yeah, automated AI is taking more control away from scripters now more than ever. but before patch 1.59, i had no issues with using disableAI for straight flight c130 with paradrops so it must be a new thing.

Have not noticed any change after patch 1.59, but then again, did not test against AA armor, only AA soldiers.

wich were both known before and after spawns, multiple times.

Share this post


Link to post
Share on other sites

Now I investigated a bit further.

On the map there is:

-a Civilian player

-an Opfor preplaced Tunguska

-the spawned Blufor plane

Observations:

-the pilot's "knowsabout" value for both the Civ and Opfor units stay 0 all the time for both straight and detouring planes!

-neartargets for every pilot stays empty for the whole run

Observations vol. II:

-The pilots DO manuveur to avoid the Tunguska:

IF the tunguska is BETWEEN targetpos(player) AND them, they take a detour.

IF the targetpos is closer to them than the tunguska (that is they don't need to fly above it) they think a bit right after spawning (they waggle the wings for a sec or two), but they ALWAYS decide on the straigth line.

IF targetpos is very close to tunguska, they sometimes go mad, doing huge circles.

Conclusion:

The size of the detour and the choosen path IS in connection with enemies behaving dangerous in the pilots initial path.

Although I haven't yet found a way to measure this...

The hot-straight-path didn't cool down even after minutes of first encounter.

Share this post


Link to post
Share on other sites

Hmm.. I once made a similar script using waypoints instead of 'doMove'. While it had its problems, the plane (AFAIK & IIRC) always flew in a straight line towards its target. Maybe it´s worth a try.

The one thing I couldn´t get to work was having the bombs reliably spawn and drop at the exact right moment.

No matter how and how often I check the distance to target - on one of 5 or 6 runs the bombs were dropped way too late (never too early) hitting the ground up 150m behind target. On the next try with the same route to the same target the bomb hits exactly where it should.

I can only guess this is caused when the host computer is too busy in the moment the bomb should be released. Is there any chance one of you has already encountered and solved a similar problem?

Share this post


Link to post
Share on other sites

Offtopic, but there is the levelling force of air friction causing this effect. You need to disable it by manually calculating the normal gravity path of a falling bomb and adjusting by setVelocity. Try to drop boxes together with bombs, you will see. :)

Ontopic:

I tried with the move command, which is like giving a waypoint, effect is the same.

Effect is exactly the same with real move waypoint as well. :)

Edited by zapat

Share this post


Link to post
Share on other sites

I think this may be related to danger FSM kicking in, but i can't test it right now.

At least i also had various strange, seemingly unexpected problems with AI until i removed the value of fsmDanger="..." in units config.

...do not take my word for it, i am not exactly sure myself, but i think this may be worth looking into.

Share this post


Link to post
Share on other sites

i imagine the entire issue is due to the shilka being aware of first enemy goes into combat mode and starts activly scanning with its radar. now when next plane comes, it gets a radar lock quickly and then maybe its automated danger fsm or something that kicks in, (high danger, AA lock warning in the plane)..

Share this post


Link to post
Share on other sites

Well, the issue is the same with T-72s firing from their machine guns...

Share this post


Link to post
Share on other sites
Offtopic, but there is the levelling force of air friction causing this effect. You need to disable it by manually calculating the normal gravity path of a falling bomb and adjusting by setVelocity. Try to drop boxes together with bombs, you will see. :)

I simply determined the correct distance for dropping the bomb by trial and error and it does work most of the time. So, if air friction is constant it shouldn´t be the cause of the problem - or am I missing something here?

Also: in older versions of the script, which were less optimized for performance, I noticed the bombing would miss every time when no player was near to observe it - very strange...

Sorry for threadjacking, everyone. I´m just baffled that this doesn´t seem to be a problem in similar scripts by other people.

Share this post


Link to post
Share on other sites

i did a few more tests on this with a A10, my first spawned plane always follows the main roads a little when flying towards marker behind me.

the rest of the spawned planes fly straight until they get contact with the enemy ZU shilka i placed.

tried disableAI "MOVE", removeall eventhandlers relating to hit, firednear, incomingmissile, setSkill of pilot to 0. pilot setCaptive etc..

still same beheaviour, plane trys to avoid getting hit, also i think first plane avoids as well, but the shilka is slower to fire at it than it is at the next planes, therefor maybe giving the illusion it is NOT avoiding.

My only workaround atm is to take away control fully from the pilot and then setPos the plane dynamically along its flightpath.

like moving toys around on a board.

Share this post


Link to post
Share on other sites

I would be interested more in that danger.fsm. I found it in the files, and could take a look into it: I am no expert in fsms though. Yet. :) It could be the key, and a key to deeper understand general AI.

I found the topic about it, but couldn't find the method to turn that off...

Otherwise the only method is what Demonized said, probably an easier solution would be playing with bank by vectordirandup, so you could disable turning. i even have the functions for that, but it would probably kill performance as well.

to the offtopic topic: air friction not only has a slowing effect (which is a constant) but a lifting effect too. And it probably needs a more complicated formula. I found it easier to move the bomb by the script according to simple gravity acceleration without lifting, than find and apply the lifting formula...

Share this post


Link to post
Share on other sites

I think i found a fix. Place a hostile anti aircraft unit near the starting position of your aircraft, but give it no ammunition. The planes ignore it and then then fly Straight over the "live" enemy units without any evasive moves. Hope this helps, was bugging me for ages. Better late than never:D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×