Jump to content
Sign in to follow this  
txalin

Destroy a missile when it enters into a zone.

Recommended Posts

Hi all,

First of all, let me introduce the proyect that the spanish community have launched two months ago. The proyect is called "Guerra total" or total war in english, the goal is to conquer the island, on this case panthera. We have two armies, us vs opfor, with one general and four HCOs, a few sergeants for each squads and in the end the soldiers, also, we have a logistic system, with factorys and communication nodes, each factory and comm node produces UPs points, that were used to buy armor, choppers, tanks, trucks, jeeps and so, obviously each tpe of armor has a different price. At this moment, we are about 60 players on each side, so on each game you can see a lot of big battles, with transport choppers, attack choppers, tanks, aa's, etc... it's very very funny to play :)

But, and now i'm going to explain the problem, sometimes, by accident, pilots locks one target at 3km and throw their missiles, destroying the target, the problem is that sometimes target is on the airport, that i'ts the restricted zone were enemy forces cannot enter or attack it. We have an script to kill any enemy unit that enter on the prohibited zone, but we didn't found any solution to destroy those missiles.

Do you know if there is any way to detect that the missile has entered on the "prohibited" zone and destroy it automaticly?

Thx and regards,

Share this post


Link to post
Share on other sites

I'm looking for exactly the same thing (lag-free).

p.s. Panthera will get updated in few days with a brand new satellite image (improved towns and grassy areas).

Share this post


Link to post
Share on other sites

You will need to use the fired event handler and assign it to every plane:

this addEventHandler ["fired", {_this execVM "fired.sqf"}];

fired.sqf:

_unit = _this select 0;
_ammo = _this select 4;

_marker = "NoRocketsHere"; //Name of the marker that indicates the rocket-free zone
_radius = 100; //Radius of rocket-free zone (from the marker)
_destroy = ["R_Hydra_HE"]; //Define the AMMO classnames to destroy here

if (_ammo in _destroy) then
{ //Rocket will be destroyed
    _rocket = (getPos _unit) nearestObject _ammo; //Find the rocket object

    while {!isNull _rocket} do
    {
         if (_rocket distance (getMarkerPos _marker) < _radius) exitWith
         { //Rocket inside the rocket-free zone
              deleteVehicle _rocket;
         };
         sleep 0.1;
    };
};

Share this post


Link to post
Share on other sites

thx deadfast, much appreciated :)

Share this post


Link to post
Share on other sites

would it be possible to hide the vehicles while they are in the zone preventing target locks all together. Then once they leave the zone they become lockable. I think that would be much better for your pilots that way they don't see the pesky lock box and waste a missile. It also leaves them free to search for other targets.

Share this post


Link to post
Share on other sites

Hi,

I think i found a "better" solution:

this addEventHandler ["Hit", {_this execVM "hitted.sqf"}];

And the hitted sqf:

_unit = _this select 0;

_killer = _this select 1;

_damage = _this select 2;

_marker = "NoRocketsHere"; //Name of the marker that indicates the rocket-free zone

_radius = 100; //Radius of rocket-free zone (from the marker)

if ((getPos _unit) distance (getMarkerPos _marker) < _radius) then

{ //Unit inside the rocket-free zone

_killer setdamage _dammage; //Killer receives the same dammage he makes to the unit.

_unit allowDamage false; //If the unit is inside the zone, enemies cannot destroy it;

}

else

{

_unit allowDamage true; //When the unit get out of the zone, it can be destroyed

};

I haven't tested it, will update if this script make what is suppossed to do :D

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  

×