Jump to content
Sign in to follow this  
A-SUICIDAL

I thought I would share some cool stuff.

Recommended Posts

When I make Coop or SP missions with AI on my team I, I often get annoyed that they just stand up all the time when most the time when they are near me I would prefer that they crouch without my having to constantly tell them to crouch. So I came up with a cool idea. I added to triggers to my mission for each AI teammate. So lets say I am the leader (s1) and I told an AI teammate (s2) to regroup, and I am crouched behind a short wall observing a bunch of enemy and I don't want my dumb AI teammate to run over to me and just stand there like "duh" and get spotted by the enemy and give my position away or start firing.

The 1st trigger tells the AI to stand if he is over 25 meters away. This keeps him moving fast when I need him to keep up with me.

Trigger 1:

Radius: 0

Activation: None, Repeatedly

Condition: s2 distance s1>25

OnAct: s2 setUnitPos "UP"

The 2nd trigger tells the AI to crouch if he is within 25 meters of my position. Now I don't have to give him an order to keep low.

Trigger 2:

Radius: 0

Activation: None, Repeatedly

Condition: s2 distance s1<25

OnAct: s2 setUnitPos "MIDDLE"

So now my AI teammate runs fast to my position and when he gets within 25 meters he crouches and moves slower and then stops an kneels next to me and does not fire because he would have to stand in order to be able to shoot over the short wall. At anytime I can give him the order to stand up and he will. The triggers will make him crouch again later since they repeat.

So in most of my missions where I have about 14 teammates, I add triggers that make all of my AI teammates crouch when they are close to my position. It actually makes them seem smarter and very stealth oriented, lol.

Here's something else I put in all of my missions...

The first thing I put into any new mission is 8 markers for each direction. I name the first marker "N" for North and place it the the most north position on the map. Then I place a marker in the top right corner of the map and name it "NE" for NorthEast, then I keep adding the rest of the Markers for E, SE, S, SW, W and NW. This comes in very handy later in my mission when I need certain AI to watch a specific direction, for instance, 2 enemy that are hiding (crouched) in 2 different corners inside a small bunker and I need them both to be facing and watching the entrance to the bunker, so I tell one enemy to watch NE and the other enemy to watch NW. Now anybody that enters the bunker might get shot instantly. From experience when I use number directions, the AI never seem to watch the correct direction, So instead I use markers that are named according to each direction, which makes things easier since I can never remember things like west is direction 270.

It gets better...

I place a static KORD weapon centered on top of the small bunker at a height of +1.9 and name the weapon according to the specific task and bunker (task1_bunker1_mg). I remove all of it's 50 round magazines and give the Kord a bunch of 150 round magazines so it can lay down much more fire.

Kord weapon init:

this setpos [getPos this select 0, getPos this select 1, +1.9];
this removeMagazinesTurret ["50Rnd_127x108_KORD",[0]];
this removeMagazinesTurret ["50Rnd_127x108_KORD",[0]];
this removeMagazinesTurret ["50Rnd_127x108_KORD",[0]];
this removeMagazinesTurret ["50Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];
this addMagazineTurret ["150Rnd_127x108_KORD",[0]];

and now for the good part... I move an enemy named "task1_bunker1_gunner" into the gunner seat of the Kord (task1_bunker1_mg).

When task1 starts I spawn the enemy in the task1 area and have a script that moves enemy into the gunner position.

task1_bunker1_gunner moveInGunner task1_bunker1_mg;

and I have the Kord gunner watch several different directions and pause in between using this script that works in conjunction with the directional markers that I placed in my mission.

while {not isNull task1_bunker1_gunner} do {
task1_bunker1_gunner commandWatch markerPos "N";
sleep 5;
task1_bunker1_gunner commandWatch markerPos "SE"; 
sleep 5;
task1_bunker1_gunner commandWatch markerPos "SW";
sleep 5; 
};

Normally without this script, the AI gunner never moves ever, he never sees me or fires at me ever, even if I am flying around near him - he just sits on the gun and sleeps and is not much of a threat at all. I could run up and shoot him at close range and take him out easily most all of the time. The only time he seems to fire at me is if I am at close range and right in front of him. If he ever does fire his gun, he fires it for a short moment and stops because his gun is already dry and needs reloading. With the way I set things up, the AI will now spin around watching all directions, if you are very far away he will spot you and he will stop spinning around watching all directions and he will instead try to kill you and he will lay down alot of fire. If he does kill you, he will then continue to spin around watching all directions again. He usually spots you long before the other AI in the area do and it then seems to alert all of the other enemy of your presence. I actually have to tone down the accuracy skill of the enemy in my missions because it can become to difficult.

In my mission I have several bunkers like this in each task areas that need capturing - and if you dare fly, the bunker gunners will all spot you from very far away and open fire on you with a long shower of bullets - normally they never would. If you finally do kill the bunker gunners, you still have to deal with 2 enemy snipers that pace around inside the bunker between 2 markers and will not leave the bunker - and if you manage to kill them, there are still 2 more enemy crouched inside the bunker watching the entrance. And when you finally manage to enter the bunker and kill them, it usually then spawns some choppers that fly into the area and drop a bunch of enemy at your position, or a couple of tanks spawn and move fast to your position. No matter what, my bunkers are not easy to capture. I also have H-Barrier walls surrounding the bunkers to prevent the enemy AI inside the bunker from going prone and shooting through the bunker walls, which they normally always do since their rifle barrels poke right through the thin walls. There are no A-10's and Apaches in my missions ever, so defeating these bunkers actually requires a bit of effort. Normally, by the time you spot one of the bunkers, you are already dead.

I still script things like a total newb sometimes, but I still manage to make some fun missions and avoid script errors. I'm sure there are similar or better scripts like the simple ideas I've posted here, but I do the best I can and try to share.

Try the spinning gunner script using a spotlight and add one to your base or an enemy camp for those night missions, but only add 1 or you will get a headache from all of the spinning lights. And don't start the mission at an hour when it's pitch black out, but instead have it be a little light out, sometime before sun up, otherwise the spinning light is too bright and annoying and it won't look realistic. If done right it looks great and adds alot of life to any base.

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites

Hi, you've got some nifty ideas going there.

I'd like to know about the Directional markers. I assume they are Hidden?

So, you've got a Hidden marker named "north", placed on the map with no text, I assume, and in-game, the unit will look at the marker?

I think that's keyboard 1 or 2 or was it 3?

About this code:

while {not isNull task1_bunker1_gunner} do {
task1_bunker1_gunner commandWatch markerPos "N";
sleep 5;
task1_bunker1_gunner commandWatch markerPos "SE"; 
sleep 5;
task1_bunker1_gunner commandWatch markerPos "SW";
sleep 5; 
};

Where does it go? Could you be more specific?

Thanks.....

Any more ideas you've got, please share them.....

Share this post


Link to post
Share on other sites

great stuff mate sure that will all be extreamly usefull to alot of mission designers ;) ;););););)

---------- Post added at 22:30 ---------- Previous post was at 22:29 ----------

i wonder if that commandwatch code will work on getting enemy morter positions to actually spot and fire on u seing as they never ever fire on anything

Share this post


Link to post
Share on other sites

Yeah, the markers are hidden during mission, but in the editor they can be seen. Just add a new marker and name it "N" for north and then for the text just type "N" again, and don't change anything else, then drag it to the most north location on the map. Do it again for all the other directions NE,E,SE,S,SW,W,NW.

It should work fine with mortars. I've done it with D-30 artillery. You can basically make anything scan around.

Share this post


Link to post
Share on other sites

hold on you telling me this will actually make the ai morters actually shoot at us players man thats choice

---------- Post added at 19:30 ---------- Previous post was at 19:22 ----------

Testing now ;)

Share this post


Link to post
Share on other sites

Mortars are a bit weird. To get Mortars to fire at will is a little different, but still easy. I've used them in missions, but I much prefer using the D-30 artillery since it's more direct, fast and scary as hell.

Just placing a D-30 in your mission with an Artillery module doesn't work as well as when you also force the artillery gun to scan. Without the scanning script, if the artillery gun has it's back to you, it won't ever see you and it's very easy to simply snipe and kill the gunner.

If you're interested in using a D-30 that scans, Try this...

Place 8 markers named N,NE,E,SE,S,SW,W,NW at the corresponding locations along the border of the map.

Place a US marksmen and a hill(doesn't have to be that high up) with this in his init(to keep you from dying):

this addEventHandler ["HandleDamage",{false}];

Now place an empty HMMWV beside the US marksmen on a hill.

Place a D-30 Artillery gun about 300 or 400 meters away at a lower altitude with its back to you and put this in D-30 init:

null = [] execVM "arty1.sqf";

Then copy the following and paste it into

art1.sqf:

arty1 setCombatMode "RED";

while {alive arty1} do {
arty1 commandWatch markerPos "N";
sleep 1.8;
arty1 commandWatch markerPos "NE";
sleep 1.8;
arty1 commandWatch markerPos "E";
sleep 1.8;
arty1 commandWatch markerPos "SE";
sleep 1.8;
arty1 commandWatch markerPos "S";
sleep 1.8;
arty1 commandWatch markerPos "SW";
sleep 1.8;
arty1 commandWatch markerPos "W";
sleep 1.8;
arty1 commandWatch markerPos "NW";
sleep 1.8;
};

Now add an Artillery module. There is no reason to synchronize it to anything. Actually, you don't even need it at all, but I use it for other things in my mission.

Now preview the mission and you will notice the artillery gun scanning around, but he probably won't see you since AI have brain tumors. Wait until he scans around and has his back to you, then hop into the HMMWV and drive a few feet and stop and leave the engine running, he will definitely spot you the next time he scans passed your position. Usually they spot vehicles very fast if they are moving or if the engine is still running, but you could also snipe near his position a few times with your rifle to get his attention just the same. His accuracy is another story, but that can be tweaked with other scripts. I actually prefer that he misses alot.

Now if you try testing the mission without the scanning script and clear the init of the D-30 gun and when you start the preview, hop inside the HMMWV and start driving around and the D-30 will not see you or fire at you unless you drive way out directly in front of where his gun is pointing. Or if you start the preview and try to get the D-30 gunners attention by shooting at his gun, it usually takes about 10 or more shots before he finally turns around and looks for you, which is lame since if it was a real mission you would have just killed him before he ever knew you were in the area. So yeah, the scanning script really helps.

In my latest mission I placed 3 empty D-30's at one end of the airstrip and another 3 at the other end. I tell all 6 D-30's to be hidden using arty_name hideObject true;. When the airstrip task is eventually assigned I then run a script that set all of the arty guns to arty_name hideObject false; and I then spawn the gunners and then use assignVehicle, orderGetIn and moveInGunner and then script the guns to scan all directions. I even spawn men that are moved into the cargo of the guns and if the gunner dies it will then eject the man that is in cargo and assign and move him to the gunner seat and he will then begin to scan too.

With this method, the AI will fire their artillery guns at very close range, closer than they would normally be allowed to if they used the artillery computer. If you Kill the gunners and then get in the gun and choose the Artillery Computer on the actions menu, you will notice that there is no range circles and the "Fire" button cannot be used. The ammo count also shows as "--", which my guess means "unlimited" since I am able to keep firing the gun. The gun works well enough using just the scope lens.

---------- Post added at 11:19 AM ---------- Previous post was at 10:50 AM ----------

For mortars, what you want to do is set up triggers in several areas that execute a script that force the mortars to fire at the area where the trigger was activated. Not very realistic. Or script it so the player that trips the trigger becomes the target.

Edited by A-SUICIDAL

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  

×