Jump to content
Sign in to follow this  
d3nn16

Warfare : Kamov unable to hit air units

Recommended Posts

A script for Warfare that will prevent Kamov pilots to hit air units with their missilles.

I didn't test this script it in a dedicated server environment yet so I'm not sure it will work.

The idea is to add an "incomingmissile" event handler to all air units that are created. This handler will delete the Kamov missiles as soon as they are created.

The code :

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

mychop addEventHandler ["incomingmissile",

{

_ammo = _this select 1;

_whoFired = _this select 2;

if (_ammo == "M_Vikhr_AT") then

{

[_whoFired] spawn

{

_deleted_missile = false;

while {!_deleted_missile} do

{

sleep 0.1;

_missile = nearestObject [position (_this select 0), "M_Vikhr_AT"];

if (!isNull _missile) then

{

hint str [_missile];

deleteVehicle _missile;

_deleted_missile = true;

};

};

};

};

}];

Remarks :

If AI fires on you unguided missiles/rockets the incomingmissiles event will still be activated.

When I tested this I didn't check if _ammo was equal to "M_Vikhr_AT" and I didn't do the sleep 0.1 so when the Kamov started firing rockets at me my PC lagged horribly (the chopper was grounded that's why Kamov was firing rockets).

Doing one of _ammo check and sleep avoids the lag.

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  

×