Home   Help Search Login Register  

Author Topic: Delete shells/missles after a set distance?  (Read 830 times)

0 Members and 1 Guest are viewing this topic.

Akbar

  • Guest
Delete shells/missles after a set distance?
« on: 09 Jun 2006, 02:34:02 »
I was wondering if there is a way to delete shells/missles after they are shot and reach 1,300 meters... it would prevent long range shooting which is a problem in the map. If possible i dont want it to affect missles shot from choppers.


 .  8)

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Delete shells/missles after a set distance?
« Reply #1 on: 13 Jun 2006, 19:53:47 »
You can use a "fired" eventhandler to initiate a script which would then monitor the distance between the fired projectile and the vehicle that fired it, when the distance reached > 1300 the shell would be deleted.

In the init feild of the vehicle (or form a script) put:

Code: [Select]
this addEventHandler ["fired", {_this exec "deleteShell.sqs"}]
Then in your mission folder put a script called "deleteShell.sqs".  That script will look like this:

Code: [Select]
_unit = _this select 0
_shell = nearestObject [_unit, _this select 4]
@ _shell distance _unit > 1300 || typeOf _shell != _this select 4
deleteVehicle _shell
exit

the
Code: [Select]
@ _shell distance _unit > 1300 || typeOf _shell != _this select 4 line waits for the shell to be at least 1300 m from the unit that fired it or if it explodes/hits the ground.  After either of those conditions are fullfilled the script deletes the _shell.
« Last Edit: 13 Jun 2006, 19:59:28 by Raptorsaurus »