Jump to content
Blitzen

City Combat--Stay in the City AI!

Recommended Posts

I've been building a mission where NATO forces assualt a city held by Russian forces. I've fortified the city, placed AI units in buildings, etc. and every thing is ready to go. My problem is that the AI groups placed in the city notice the incoming forces and move to attack. Instead of having an intense street battle, I end up having fights outside of the city. How can I force AI groups to stay within the city?

**NOTE**Just for reference I am playing on the FFUR 2007/SLX mod and this might be causing some problems. Namely the AI engages and ID's enemey units from greater distances.

Thanks,

Blitz

Share this post


Link to post
Share on other sites

This script holds AI in position.

http://forums.bistudio.com/showthread.php?p=1656539#post1656539

You can place them behind fortifications and the like. IIRC, if the enemy is near and/or the AI is shot they will move out of position and away.

FYI, you may need to rename the script file to Aicover2 if you get error about the script not being found.

Share this post


Link to post
Share on other sites
This script holds AI in position.

http://forums.bistudio.com/showthread.php?p=1656539#post1656539

You can place them behind fortifications and the like. IIRC, if the enemy is near and/or the AI is shot they will move out of position and away.

FYI, you may need to rename the script file to Aicover2 if you get error about the script not being found.

I actually used the AI cover script in the mission. Though its great for putting AI units behind cover, I am looking for a way to keep an AI group inside a trigger/area (in this case a city).

Share this post


Link to post
Share on other sites

Are You wanting say, thta You need that the AI don't leave of the town?

If that's I THINK, I don't sure if I'm wrong, but Why don'y You use the AllowFleeing command?

If that don't work, Ask again, I'll try help You

I hope it Help

Regards,

Aldo

I've wrote this post using my Knowledge, I didn't used traductor, that's I offer you my apologies. :p

Share this post


Link to post
Share on other sites

What about Urban Patrol Script by Kronzky? The group patrols a certain area definite by a marker. The group should keep itself in the area of the marker. You can additionaly use the NOAI function which disables AI flanking and manoeuvres.

More here: http://kronzky.info/ups/index.htm

Share this post


Link to post
Share on other sites

You can try this.

-Put this script into your current mission folder, name the script by example

dcheck.sqs

_grp = _this select 0
_obje = _this select 1
_dist = _this select 2

#chkloop
_sz= count units _grp
? (_sz==0) : goto "end"
? (leader _grp distance _obje) >= _dist : goto "out"
~2
goto "chkloop"

#out
_grp move getpos _obje
~5
goto "chkloop"

#end
exit

-put a game logic +/- at the location you would want your AI squad to be, for this example name this game logic

T1GO

-in the init line of the leader of this squad put :

TEAM1=group this

Wherever you need to have the script running, depending on the mission situation, have it launched by :

[TEAM1,T1GO,50] exec "dcheck.sqs"

By example, you can put it in the AI leader init line

TEAM1=group this; [TEAM1,T1GO,50] exec "dcheck.sqs"

What it will do is check regularly for when TEAM1 current leader is going at more than 50 meters from the T1GO game logic.

And when it happens, it orders TEAM1 to move back to T1GO

You can change the distance to how much you want.

If you have more than 1 AI squad, define a game logic for each of them, name it differently, and you can use somewhere

[TEAM1,T1GO,50] exec "dcheck.sqs"; [TEAM2,T2GO,50] exec "dcheck.sqs"; [TEAM3,T3GO,50] exec "dcheck.sqs"

To have those 3 squads checked

Edited by Sanctuary

Share this post


Link to post
Share on other sites
You can try this.

What it will do is check regularly for when TEAM1 current leader is going at more than 50 meters from the T1GO game logic.

And when it happens, it orders TEAM1 to move back to T1GO

I think I've already tried the same thing you've suggested, but I did it differently.

if(this distance leader XXXX>50)then{[this,1] setWPpos getpos leader XXX}; false
**Note that this isnt a copy of what I used but it gives you a general Idea of what I did.

I put this in the condition line of the waypoint and it worked similar to your script. The problem is that the units will be under fire, etc. and dont always immediately return to the area. To make units return to a certain area, I am assuming you would have to set their behavirour to careless, and that would give "freebie" shots to the attackers.

What about Urban Patrol Script by Kronzky?

I already have that amazing tool :D The problem is that I believe (not 100% sure though) the AI will venture outside of the area that you've designated in order to attack enemies.

I dont think that there is a simple solution. What I think is required is to somehow tell the AI that it is limited to a certain area that you have defined by a trigger, marker, etc. Essentially, I dont believe that its going to be a simple fix. However, since this would only really be applied to city combat, its not big of a deal.

On a side note....:) I finished my mission by placing enemy units on the other side of the city. The timing works out and I've had several big city battles. I must say that if you take the time to add foritifications and place units, within cities, you can have some pretty epic battles :pistols:

Share this post


Link to post
Share on other sites

Lower the 50 distance a lot, this way the leader would never really move away enough from the game logic to be under fire out of town.

Share this post


Link to post
Share on other sites

whoops -thought I had a working script. Saw it was not correctly done. Was going too share but it looks as if it's on my other pc.

Edited by WW2Weasel

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

×