Jump to content
Sign in to follow this  
Bunny75

Spy plane

Recommended Posts

The main idea is to spawn an ai plane, make it fly through a map and place markers on the map where it spots enemy units.

So I guess this would be done with a trigger naturally. Somehow it should repeatedly pick a units the spy plane knowsAbout > 0.105 and pass them to a .sqf that would parese them with isKindOf "" method and place markers to them accordingly.

So the Trig would be something like:

OPFOR

DETECTED by BLUFOR

Repeated

COND: this && {(spy_plane knowsAbout _x)} > 0.105

ACT: {[_x] execVM "mark_enemy.sqf"} foreach thislist

I think I can manage the .sqf, but the conditions and actions on triggers are beyond me.

Anyone have a clue what would they be?

Share this post


Link to post
Share on other sites

You might want to consider using the nearTargets command for this, as it represents exactly what the spy plane "knows" about any enemy units in the area (including inaccurate assumptions about enemy positions).

Personally, I would run a loop that calls a small "detector" function at 1 second intervals.

spyPlaneIsActive = True;
detectedUnits = [];

while {spyPlaneIsActive} do
{
 [spyPlane] execVM "spydetect.sqf";
 sleep 1;
};

spyPlaneIsActive would be a control variable you can set to false when you want the plane to stop "scanning". spyPlane refers to the actual plane. detectedUnits is something you should define to store any units that have already been detected. That way you can make sure they don't get marked over and over again.

The spydetect.sqf would look something like this:

_spyPlane = _this select 0;

{
 _pos = _x select 0;
 _cost = _x select 3;
 _unit = _x select 4;
 if ((_cost > 0) and !(_unit in detectedUnits)) then
 {
   _markerName = str(_unit);
    createMarker [_markerName, _pos];
   _markerName setMarkerShape "ICON";
   _markerName setMarkerType "Dot";
   detectedUnits = detectedUnits + [_unit];
 };
} forEach (_spyPlane nearTargets 1000);

Please note that I'm not sure this code will work "out of the box" because I can't test it at the moment.

Edited by MadDogX

Share this post


Link to post
Share on other sites

Cool! I'll give it a try...

---------- Post added at 10:59 AM ---------- Previous post was at 10:26 AM ----------

Brilliant! Here's the full code:

if (!isServer) exitWith{};

_spyPlane = _this select 0;

{
 _pos = _x select 0;
 _cost = _x select 3;
 _target = _x select 4;
 if ((_cost > 0) and !(_target in detectedUnits)) then
 {

   _type = "empty";

   if (_target isKindOf "Plane") then {_type = "Plane"};
   if (_target isKindOf "Helicopter") then {_type = "Helicopter"};
   if (_target isKindOf "Tank") then {_type = "Tank"};
   if (_target isKindOf "Car") then {_type = "Car"};
   if (_target isKindOf "Man") then {_type = "Man"};
   if (_target isKindOf "StaticAAWeapon") then {_type = "AntiAir"};
   if (_target isKindOf "StaticCannon") then {_type = "Artillery"};


   _markerName = str(_target);
    createMarker [_markerName, _pos];
   _markerName setMarkerShape "ICON";
   _markerName setMarkerType _type;
   _markerName setMarkerColor "ColorRed";
   detectedUnits = detectedUnits + [_target];

   sleep 30;
   deleteMarker _markerName;

 };

} forEach (_spyPlane nearTargets 2000);

I delete them at the end so it'd be like a radar "blip". And in this case I use mil symbols module.

Share this post


Link to post
Share on other sites

hey Bunny75, this sounds similar to something I was trying to do. Except yours is more sophisticated! :)

Do you mind sharing a mission example?

Thanks.

Share this post


Link to post
Share on other sites

Of course not!

I'll put up a link tomorrow. I only have these at work :)

Share this post


Link to post
Share on other sites

sorry and Readme ?:icon_wink: for this script! Not all players! Who wishes to use this script! Clever also know as it to use :banghead:

Share this post


Link to post
Share on other sites
sorry and Readme ?:icon_wink: for this script! Not all players! Who wishes to use this script! Clever also know as it to use :banghead:

I'm not sure if this is directed to me, but I really don't understand. :confused: Sorry.

Share this post


Link to post
Share on other sites
I'm not sure if this is directed to me, but I really don't understand. :confused: Sorry.

Bunny I think he means he doesn't have a clue how to use this script in the editor (how to set it up etc)?

So the readme would be for him like and instruction manual?

Share this post


Link to post
Share on other sites

Ok... I guess I could make something. There is some notes in the recon_plane.sqf, but I could elaborate more.

Share this post


Link to post
Share on other sites

Thx for readme! Still a question:j: The plane can be call only once? and plane no atack emeny :( jast fast go to point! and finish(( and one more :) How to change the plane? for A-10! (Excuse for many questions! And bad English)

I wish to use a suport plane call in Domination map (I know! I want much :( )

Edited by Keshman

Share this post


Link to post
Share on other sites
The plane can be call only once?

Nope, when it has done the sweep it's been deleted and the .sqf waits for 120 seconds. After that it comes available again. You can change the sleep time to make it available faster. You can change the sleep time in the end of recon_plane.sqf

plane no atack emeny

Nope. It's a recon plane :) If you wan't some sort of airstrike, the easiest way might be to use SOM module.

How to change the plane? for A-10

Change:

recon_plane = createVehicle ["F35B", getMarkerPos "air_spawn", [], 0, "FLY"];

to:

recon_plane = createVehicle ["A10", getMarkerPos "air_spawn", [], 0, "FLY"];

I know! I want much :(

You can never have enough. The trick is to understand that you already have everything you need ;)

Share this post


Link to post
Share on other sites

Bunny75 Again to you thanks! I have changed the plane and time! :) If to remove deleteVehicle recon_plane; deleteVehicle recon_pilot; That it is necessary to change still! That the plane attacked the target?:) (I do not know that such the SOM module) :(

Edited by Keshman

Share this post


Link to post
Share on other sites
Bunny75 Again to you thanks! I have changed the plane and time! :) If to remove deleteVehicle recon_plane; deleteVehicle recon_pilot; That it is necessary to change still! That the plane attacked the target?:) (I do not know that such the SOM module) :(

Those delete commands are on the trigger which deletes the plane and it's pilot, nothing else.

If you wan't to try to make the plane to be more aggressive change:

//SET FIRST WAYPOINT TO MARKER RECON POINT
_sp_wp_0 = _recon_grp addWaypoint [getMarkerPos "recon_point",50];
_sp_wp_0 setWaypointType "MOVE"; 
_sp_wp_0 setWaypointSpeed "FULL";
_sp_wp_0 setWaypointBehaviour "CARELESS";
_sp_wp_0 setWaypointCombatMode "BLUE";

to this:

//SET FIRST WAYPOINT TO MARKER RECON POINT
_sp_wp_0 = _recon_grp addWaypoint [getMarkerPos "recon_point",50];
_sp_wp_0 setWaypointType "SAD"; 
_sp_wp_0 setWaypointSpeed "FULL";
_sp_wp_0 setWaypointBehaviour "COMBAT";
_sp_wp_0 setWaypointCombatMode "RED";

But I think the whole thing must be thought again. Do search for SOM module and/or airstrikes.

Share this post


Link to post
Share on other sites

Yes yes! :yay: Its work! (your last sistem) A-10 atack target!! :) Big THX men!)

Share this post


Link to post
Share on other sites
I'm not sure if this is directed to me, but I really don't understand. :confused: Sorry.
Basically he's saying "Document it and provide readme cause not players can understand it! You douche!".

Well ok, he didn't say the last part, I just added that as an dramatic effect to his ungratefulness. :)

Share this post


Link to post
Share on other sites

Testing NEW:D script in Domination map! Work good! litel time :( ( if you die! and respawn again! in base or HQ srcript no work again)

Do not kill me :D for Last two questions:

1.(Very important) How to rectify this error? (script no work you die and respawn again)

2.(Not so important) How creat 2 plane A-10 for respawn :)

P.S. If these two errors it will be possible to correct! It will be a miracle!:)

Edited by Keshman

Share this post


Link to post
Share on other sites

Help please! Who knows as correctly to use this script in a Domination map:icon_redface: (Look mine before last post)

(sorry again for bad english)

Share this post


Link to post
Share on other sites

Has solved a problem :) Has added a script in a flag base)) work all time)) for ALL BIG THX!

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  

×