Jump to content
Sign in to follow this  
sphoenix

Reporting enemies

Recommended Posts

Hi everyone!

With the help of 5133p39 I created this script.

It uses the function nearTargets to list all the enemies a unit knows about in a given range.

And then it creates a red dot on the map to mark its last known location.

Here is the code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_i","_m","_oldI"];

_oldI = 0;

while {true} do {

Array01 = P01 nearTargets 100;

Array02 = P02 nearTargets 100;

Array03 = P03 nearTargets 200;

Array04 = P04 nearTargets 100;

Array05 = P05 nearTargets 200;

Array06 = P06 nearTargets 200;

Array07 = P07 nearTargets 100;

ArrayEnnemis = [Array01, Array02, Array03, Array04, Array05, Array06, Array07];

_i = 0;

{

  {

    CampEnnemi = _x select 2;

    if (CampEnnemi == east) then {

      _m = format ["mark%1", _i];

      // create marker if _m not exists, otherwise only setpos the existing one

      if ((getMarkerPos _m) select 0 == 0) then {

        _m = createMarker [_m, _x select 0];

        _m setMarkerShape "ICON";

        _m setMarkerType "Dot";

        _m setMarkerColor "ColorRed";

      } else {

        _m setMarkerPos (_x select 0);

      };

      _i = _i + 1;

    };

  } forEach _x;

} forEach ArrayEnnemis;

// delete markers of old, forgotten targets

while {_oldI >= _i} do {

  _m = format ["mark%1", _oldI];

  if ((getMarkerPos _m) select 0 != 0) then {

    deleteMarker _m;

  };

  _oldI = _oldI - 1;

};

_oldI = _i;

sleep 30;

};

This script is called once for the whole mission and is used once for all the units you want (no need to multiply the utilisation of this script, just set up one trigger and you're good to go).

As is, this script is used with US units to report SLA units.

You can change it through the CampEnnemi variable, set it to be equal to west or guer.

You can always change, as well, the marker shape and color.

This way you will be able to use the script for both sides.

You can easily customize the range of the nearTargets function to suit your needs at the beginning of the script.

The P01, .. , P07 are variables attached to units.

If you want the script to report the enemies spotted by a whole group, you can just name one of the units in the group, like the group leader, and use the script on him.

Note the "sleep 30" at the end of the script: it is used to renew the markers every 30 seconds.

The markers are updated, and therefore you won't see the movement of the enemy as time passes.

Feel free to customize this script as much as you want - it's all yours!

Happy playing and happy editing to everyone smile_o.gif

PLEASE NOTE: the script is in sqf syntax. You need to call it with execVM.

Kindly

SPhoenix

Share this post


Link to post
Share on other sites

Its nice of you to mention me, but you don't need to do that.

My point is - where do you think i got my knowledge? i certainly didn't find it lying on the street. Other people told me what i needed to know (except for the very little amount of things which i learned through experimenting), and almost every single thing i make is based on knowledge of others, and since you didn't gave credit to those people (even i don't rememeber them), no need to give credit to me.

...but of course only until you start making money from these things ;-)))

btw. also the script is pretty simple - you can mention me when i give you whole new CTI game or something like that, but no need to credit people for these little pushes into the right direction.

Share this post


Link to post
Share on other sites

I didn't do the script on my own, I only designed the initial layout.

It feels right to mention you.

I just couldn't have done it without your help lol yay.gif

Share this post


Link to post
Share on other sites

Good work!

I am trying to incoporate the script into my mission, but I am a newb when it comes to scripting, especially with sqf files...

How exactly do you get it to work? right now I have the script file in my mission folder and im using this command in my players init:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

null = [this] execvm "uav.sqs"

obviously it's not working help.gif

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  

×