PDA

View Full Version : need help ai script


soundken
01-04-06, 04:58 AM
im having a little trouble with the ai script/trigger system

i am trying to create mp missions where the diffrent available platforms will still function properly (for the ai anyway) and still be kinda random in there spawn point / approach vector / tactic

what i have so far, ive found that just using random start box's in cordination with random search boxes does move the unit (this case sub) around a given area and create enough randomness for mp and sp play

the problem i have is getting the ai to attack. if i set on page one to attack and choose the main target (this case lead of 4 ship convoy) then the ai does close and will initiate but only on that one ship and at extreamly close range. the ai also tends to ignore any escorts (other player controled) only somtimes engaging but again only torpedo and only close range

ive been trying to write a script but cant seem to get it to work basicly what i want is this:

if {Red sub} detects {any object blue) with (any) then (attack) with (best weapon)

in this case i want (best wepon) to be missles at long range than closing to torpedo,

question. when i choose "then" in the script editor it ends the script ? shouldnt there be a continuation to the line ? anyone any luck with this or does it need to be attached to a waypoint?

LuftWolf
01-04-06, 12:41 PM
My advice is to put all the platforms in the way you want and then see if they behave the way you want them to on their own without having to script anything.

You should be aware that the AI performance in stock DW is a little lacking for two reasons: some of the doctrines are not as well done as they could be; and the main reason, the non-playable units do not have sensors attached to them that function effectively, so most AI platforms are essential sonar deaf.

The LWAMI Mod addresses a few of these concerns. Try running the same mission with the mod and without any scripts or triggers, and if the platforms detect each other, they should engage.

Note, there is one thing you can do that might help things. You can put a trigger in the instructs an AI platform to autoclassify the contact immediately, rather than wait for the usual classification as the target confidence gets higher. So, you can set a script to run that once the target it detected by a platform, the detecting platform automatically has it's ID, this should increase the speed and aggressiveness of the engagement. Also, I have found that unless you are trying to get AI platforms to exclusively attack a single target, it is best to leave their mode as "none" and not specify a target, as this will allow the AI platform more latitude in deciding which targets to attack.

Miika
01-04-06, 03:13 PM
I can also warmly recommend the LwAmi mod. I also had some similar problems, but with this mod the AI will behave more aggressively. Nowadays I only use scripts if I want a specific target attacked.

About the last part: Are you talking about a script or the "use doctrine language" part of a goal? In the latter case, using "then" will simply trigger the goal once the defined conditions are met. Choosing "and" or "or" with allow these logical functions to be added. (I prefer using the "aggregate" goal type instead of these.

Miika

soundken
01-04-06, 08:12 PM
i am using the lwami mod with 1.03b

thanks mika i was looking at the doctrine editor wrong :damn:

lw i tried the no scripts thing in the beginning, however must go back and try removing the attack function, (if i remember correctly this made the sub just drive by the convoy and not engage at all have to recheck)

torps at close range are no problem, though would like the subs to be a little more agresive with the merchants rather than the escorts. sub vs sub the ai behaves fine.

the problem is the missles they just dont seem to want to use em does an ai missle attack need to be a completly scripted event or will they do it on there own? ive never seen em do it mabey someone else has? will also go back try that clasify trigger idea see if that works

if the ai is essentially deaf is there a way to bypass the detection and just make theme "drones" or write a script/ scripts to acomplish somthing like this

if (distance) to (any blue) is (less than) 40 nm but (greater than) 10 nm then (engage) missle

in cordination with

if (distance) to (any blue) is (less than) 5 nm then (engage) torpedo

also is there away toset some of target priority? as it sits the ai will go after escorts but leaves the aor's alone

Miika
01-05-06, 12:54 AM
You could put some platform, for instance a UAV or a recon plane, in the area. It will then link the targets for the subs, and they will fire missiles. I guess the subs won't use the missiles if the targets are unknown to them etc.

You can also use the (it's in "doctrine language" or "script", can't remember which) function "enter solution", which works at least for playables. I think you could use that for AI subs as well. If you enter a solution of a hostile cargo ship for an AI sub, I guess it should then attack the target. (Haven't tried, so I'm not sure.)

Usually I don't have this problem, if I make sure the hostiles have some form of radar or ESM intelligence.

Miika

MaHuJa
01-05-06, 09:27 AM
lw i tried the no scripts thing in the beginning, however must go back and try removing the attack function, (if i remember correctly this made the sub just drive by the convoy and not engage at all have to recheck)

Did you use the "transit" tactic? Try using "Transit Search" instead. That way it may actually react to what it detects.

if (distance) to (any blue) is (less than) 40 nm but (greater than) 10 nm then (engage) missle

in cordination with

if (distance) to (any blue) is (less than) 5 nm then (engage) torpedo

also is there away toset some of target priority? as it sits the ai will go after escorts but leaves the aor's alone
[/quote]

Two approach triggers attached to the sub, each running a script telling it to attack the platform with the specified weapon. There's just one problem... I think you have to do one set for each target ship.

LuftWolf
01-05-06, 11:50 AM
Yeah, if you set an objects tactic to "transit" it will literally follow the waypoints and nothing else. :88)

Basically, only use that tactic if you specifically intend the platform to just be "passing through, don't mind me...". :lol:

soundken
01-05-06, 07:46 PM
hey thanks guys :up:

up to this point ive been using random box as a tactic , in co- ordination with random start boxes and have much luck with that part of it, the hostiles start in a big enough random area and i find (having the insite of where i put things) that they become a little more unpredictable since they dont travel down a set of waypoints

unfortunatly if you dont give them some sort of attack function they go right to drive on by, or in some cassses right under the enemy, wierd thing is that the subs will attack other subs, ffg's and surface vessels will attack subs , but the subs will nor engage the surface vessel, except for ocasionaly they will fire at a ffg but not a dd or aor, even in self defense !?!

will try writing the aproach scripts for each individual convoy member ( i tried one big long script no dice, the enemy sub did come up to pd once and i thought i had it but no launch ,)

been a little busy but will let you know how it goes when i get it done