Jump to content
Cutzero

Nighttime Mission- How to make AI helicopters activly search for you (with spotlight)

Recommended Posts

Hey everyone :)

I'm fairly new to the ArmA scene and I wanted to create an awesome mission in ArmA 3. I don't want to spam you, so if anyone is interested:

Today I had an idea for a very cool mission. It's basicaly 4 player coop where the plot is that you and your friends are crashed on stratis and lost all your gear except for your weapons. They only have limited ammunition and a flashlight attatched. Oh, and it's night and very windy. Maybe raining. The goal is to reach an extraction point without getting seen. Helicopters with their very cool looking searchlights are searching for you, too and there are also infantrymen with flashlights attatched. I'm sure you get the point what kind of expierience I tried to create there.

My main questions are:

  1. How do I create enemy AI helicopters who are searching for me and my friends with the searchlight?
    I want them to actually search for me and to let their lights on.
  2. Is there a way I can place a destroyed helicopter?
    I tried to set the health/armor value to 0 but the thing was still working.
  3. How do I create waypoints so everyone has a little arrow like a GPS waypoint where they have to go?
  4. Is there a way to set up a little description text so the players know what they have to do?

I realise that these questions are newb questions, but the editor is very complex in my opinion and the alpha state doesn't help, either.

If you've read my mission idea in the spoiler and have some tipps for me how I can solve some problems or give feedback about what would make it more awesome, feel free to tell me :)

Thank you in advance

Cutzero

Share this post


Link to post
Share on other sites

Try reading the ARMA editing guide by Mr Murray. Try searching in the ARMA 2 editing section since most of your answers can be found there. Search for briefing.sqf, setting waypoints, and you can use setdamage for your destroyed helicopter.

Share this post


Link to post
Share on other sites

hi, i just found this code at armaholic forum and it looks to work very well and simulates searchlight attached to a heli.....try out:

light = "#lightpoint" createVehicleLocal position this; light setLightBrightness 0.5; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[1.0, 1.0, 1.0]; light lightAttachObject [this, [0,0,-10]];light = "#lightpoint" createVehicleLocal position this; light setLightBrightness 0.5; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[1.0, 1.0, 1.0]; light lightAttachObject [this, [0,0,-20]];

and by the way, i like the idea for ur mission, hope u will share when done :)

Longi....

Share this post


Link to post
Share on other sites

I'm a noob too - but an idea, if you don't want to do set damage - just create an empty helicopter - set the fuel to zero, elevation to 100m or something and it will drop from the sky and become a wreck. With the new PhysX and Weather it might even end up in a different place each time.

Share this post


Link to post
Share on other sites

sproyd, the helos have glue under their skids. A drop from 100m wont even damage it slightly :P

If you don't want the player to die on mission start, try spawning a Littlebird somewhere on the edge of Stratis. In the init.sqf do this:

lb setDamage 1;

sleep 0.02;

lb setpos ((getposATL player select 0) + 10);

This should kill the LB but shouldn't affect the player as it doesn't explode at his position.

Share this post


Link to post
Share on other sites

Make WP for the chopper with search and destroy mode were you want it to look for you,and you can add cycle on the last WP to let it look forever.

Share this post


Link to post
Share on other sites
Hey everyone :)

I'm fairly new to the ArmA scene and I wanted to create an awesome mission in ArmA 3. I don't want to spam you, so if anyone is interested:

Today I had an idea for a very cool mission. It's basicaly 4 player coop where the plot is that you and your friends are crashed on stratis and lost all your gear except for your weapons. They only have limited ammunition and a flashlight attatched. Oh, and it's night and very windy. Maybe raining. The goal is to reach an extraction point without getting seen. Helicopters with their very cool looking searchlights are searching for you, too and there are also infantrymen with flashlights attatched. I'm sure you get the point what kind of expierience I tried to create there.

My main questions are:

  1. How do I create enemy AI helicopters who are searching for me and my friends with the searchlight?
    I want them to actually search for me and to let their lights on.
  2. Is there a way I can place a destroyed helicopter?
    I tried to set the health/armor value to 0 but the thing was still working.
  3. How do I create waypoints so everyone has a little arrow like a GPS waypoint where they have to go?
  4. Is there a way to set up a little description text so the players know what they have to do?

I realise that these questions are newb questions, but the editor is very complex in my opinion and the alpha state doesn't help, either.

If you've read my mission idea in the spoiler and have some tipps for me how I can solve some problems or give feedback about what would make it more awesome, feel free to tell me :)

Thank you in advance

Cutzero

All of the following is what I would do in ArmA2 and SHOULD work in 3.

1. Maybe give the helicopter a group name:

GroupName = group HelicopterName

Do the same for the player group.

[GroupName , Waypoint number (+1)] setWaypointPosition [position (leader PlayerGroupName), 0]

(making the zero a higher number will randomize the exact location of the waypoint, possibly making it more dynamic).

Then I suppose you'd use the LightOn command, the exact use of which is escaping me right now. Be warned, I have only ever done this with ground units. It might cause the helicopter to crash into the player. Also, this will make the helo always move directly to the leader of the group. If you want something a little more realistic, go with the seek and destroy as mentioned.

2. this setdammage 1 in the init line. It will cause an explosion however so as others have said you can start the helicopter somewhere far away, then use the setPos command to move it once it is destroyed. If you do this, be sure to set the fuel to 0 as well or it will likely continue to experience secondary explosions.

3. I forget, that should already be the case if you put them in the editor. Mess with the "show" field in the waypoint editor menu.

4. I haven't done this yet for ArmA3 but in 2 you had to create a briefing.sqf. It's pretty simple. Just do a search for briefing in arma2 or arma3.

Share this post


Link to post
Share on other sites

if you remove all the ammunition and fuel from the helicopter, I believe it doesn't explode with setdammage, it just enters its destroyed state (or at least this has been the case for the previous titles in the series)

Share this post


Link to post
Share on other sites

Messiah that method doesnt seem to work in ARMA 3, helicopter still explodes.

Share this post


Link to post
Share on other sites

Hi everyone,


 


I had tried all of the suggested work-arounds but still got the flickering. However, I had heard about attaching a vehicle with lights to a helicopter with attachTo command and then turning the lights of the attached vehicle on. This results in no flicker at all.


 


I eventually discovered that the remote controlled drone (AR-2 Darter) is ideal for this purpose as its light is very similar to, for example, the Pawnee search light. It is also very small and so can be virtually hidden in the body of the Pawnee etc. So this is the resulting code:


 


(I created a script called YB_enemyHeliSearchLight.sqf containing the following code and then put it in mission root direcotry and then executed it using: null = _enemyHeliDriver execVM "YB_enemyHeliSearchLight.sqf";  where a driver / pilot of an enemy (i.e. AI) helicopter (of Pawnee body type) has been made equal to _enemyHeliDriver):



if (isServer) then
{ private ["_driver", "_enHeli"];
//Prepare variables:
_driver = _this;
_enHeli = vehicle _this;

while {sleep 60; true} do
{
//Wait until it is night time:
waitUntil {sleep 30; (dayTime > 20 || dayTime < 4)};

//Create "search light" (UAV) and attach it to the helicopter:
_uav = "B_UAV_01_F" createVehicle getPos _enHeli;
_uav attachTo [_enHeli, [0,1.5,-0.5]]; _uav setVectorUp [0, 0.5, 1];

//Wait until helicopter takes off:
waitUntil {sleep random 30; (getPosATL _enHeli select 2) > 5};

//If still night time, turn the search light on:
if (dayTime > 18 || dayTime < 7) then
{
_driver action ["lightOn", _uav];
};

//Wait until helicopter lands, is destroyed, or it is day time:
waitUntil {sleep 3; (getPosATL _enHeli select 2) < 5 || damage _enHeli == 1 || (dayTime < 20 && dayTime > 4)};

//Delete search light:
_driver action ["lightOff", _uav];
deleteVehicle _uav;

//Rinse, repeat via the while-do loop, in case helicopter takes off again / it becomes night again etc.
};
};

Hope this helps.


 


Cheers from Far North Queensland, Australia


 


PS: If you want this enemy helicopter to "stalk" / "hunt" a player, you can set a way point such as this on a regular basis:



//NB: curTargP1 needs to be first set as a player you are wanting the helicopter to pursue
//NB: _driver needs to be first set as the enemy (AI) unit piloting the helicopter

curTargPos = [ ((getPos curTargP1 select 0) + (_enSpreadDist - (random _enSpreadDist * 2))),
((getPos curTargP1 select 1) + (_enSpreadDist - (random _enSpreadDist * 2))),
(getPos curTargP1 select 2)];

deleteWaypoint [group _driver, 0]; //Ensure previous waypoint deleted
_heliWaypoint = group _driver addWaypoint [curTargPos, 0, 0];
_heliWaypoint setWaypointType "LOITER";
_heliWaypoint setWaypointLoiterType "CIRCLE_S";
_heliWaypoint setWaypointLoiterRadius 100;
//Make sure helicopter moves slowly and scarily!:
_heliWaypoint setWaypointSpeed "LIMITED";
_heliWaypoint setWaypointBehaviour "COMBAT";
_heliWaypoint setWaypointCombatMode "RED";
group _driver setCurrentWaypoint _heliWaypoint;
  • Like 1

Share this post


Link to post
Share on other sites

This is great,

 

How would I write the while do loop for this to happen on respawning helos on a server?

 

Will this work with any helo, not just pawnee?

 

Thanks

 

 

 

Hi everyone,

 

I had tried all of the suggested work-arounds but still got the flickering. However, I had heard about attaching a vehicle with lights to a helicopter with attachTo command and then turning the lights of the attached vehicle on. This results in no flicker at all.

 

I eventually discovered that the remote controlled drone (AR-2 Darter) is ideal for this purpose as its light is very similar to, for example, the Pawnee search light. It is also very small and so can be virtually hidden in the body of the Pawnee etc. So this is the resulting code:

 

(I created a script called YB_enemyHeliSearchLight.sqf containing the following code and then put it in mission root direcotry and then executed it using: null = _enemyHeliDriver execVM "YB_enemyHeliSearchLight.sqf";  where a driver / pilot of an enemy (i.e. AI) helicopter (of Pawnee body type) has been made equal to _enemyHeliDriver):

if (isServer) then
	{	private ["_driver", "_enHeli"];
		//Prepare variables:
		_driver = _this;
		_enHeli = vehicle _this;

		while {sleep 60; true} do
			{
				//Wait until it is night time:
				waitUntil {sleep 30; (dayTime > 20 || dayTime < 4)};

				//Create "search light" (UAV) and attach it to the helicopter:	
				_uav = "B_UAV_01_F" createVehicle getPos _enHeli; 
				_uav attachTo [_enHeli, [0,1.5,-0.5]]; _uav setVectorUp [0, 0.5, 1];	
				
				//Wait until helicopter takes off:
				waitUntil {sleep random 30; (getPosATL _enHeli select 2) > 5};
					
				//If still night time, turn the search light on:
				if (dayTime > 18 || dayTime < 7) then
					{
						_driver action ["lightOn", _uav];
					};
						
				//Wait until helicopter lands, is destroyed, or it is day time:
				waitUntil {sleep 3; (getPosATL _enHeli select 2) < 5 || damage _enHeli == 1 || (dayTime < 20 && dayTime > 4)};
				
				//Delete search light:
				_driver action ["lightOff", _uav];
				deleteVehicle _uav;
				
				//Rinse, repeat via the while-do loop, in case helicopter takes off again / it becomes night again etc.		
			};
	};

Hope this helps.

 

Cheers from Far North Queensland, Australia

 

PS: If you want this enemy helicopter to "stalk" / "hunt" a player, you can set a way point such as this on a regular basis:

//NB: curTargP1 needs to be first set as a player you are wanting the helicopter to pursue
//NB: _driver needs to be first set as the enemy (AI) unit piloting the helicopter

curTargPos = [	((getPos curTargP1 select 0) + (_enSpreadDist - (random _enSpreadDist * 2))), 
		((getPos curTargP1 select 1) + (_enSpreadDist - (random _enSpreadDist * 2))), 
		(getPos curTargP1 select 2)];	
			
deleteWaypoint [group _driver, 0]; //Ensure previous waypoint deleted
_heliWaypoint = group _driver addWaypoint [curTargPos, 0, 0];
_heliWaypoint setWaypointType "LOITER";
_heliWaypoint setWaypointLoiterType "CIRCLE_S";
_heliWaypoint setWaypointLoiterRadius 100;
//Make sure helicopter moves slowly and scarily!:
_heliWaypoint setWaypointSpeed "LIMITED";
_heliWaypoint setWaypointBehaviour "COMBAT";
_heliWaypoint setWaypointCombatMode "RED";
group _driver setCurrentWaypoint _heliWaypoint;
  • Like 1

Share this post


Link to post
Share on other sites

 

Hi everyone,

 

I had tried all of the suggested work-arounds but still got the flickering. However, I had heard about attaching a vehicle with lights to a helicopter with attachTo command and then turning the lights of the attached vehicle on. This results in no flicker at all.

Hey Yosarin, clever idea to attach the darter.  It occurred to me you may want to setcaptive true on the darter if attaching it to an Opfor chopper.  Darters draw fire, and its possible other opfor may sense it and shoot at it.  Another idea is to put a HandleDamage eventHandler on the darter so the light can be shot out (but that probably won't work since its being hidden inside the body of the chopper).  Anyway, good on ya, mate!  And remember, there's only two states be in:  Queensland or pissed.

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

×