Jump to content
Signalman

Delete Empty Vehicles

Recommended Posts

Is there a trigger, or script that will delete an empty vehicle, within a time period, after the driver has disembarked? Say, 5 or 10 minuets later for each empty vehicle. (Like a body delete script.)

Spawned vehicles using DAC V2.

MP Game.

Thanks.

Share this post


Link to post
Share on other sites

You could use a script utilizing the nearest objects command to find all land vehicles, and then test to see if there is anyone in the vehicle using the crew command.

_vehicles = nearestObjects [_location, ["landvehicle"], _radius];

{

if (count crew vehicle _x == 0) then {deleteVehicle _x};

} forEach _vehicles;

_location could be the player position and _radius could cover the entire map, say 99999.

"landVehicle" will look for any land vehicles, but you can add others into the search eg... ["landvehicle", "air"] like this.

Edited by solrac42
  • Thanks 1

Share this post


Link to post
Share on other sites
nearEntities works much faster and saves perfomance. Also you may use same technique like in Warfare BE: use managed list of all dynamicaly created vehicles.

Share this post


Link to post
Share on other sites
nearEntities works much faster and saves perfomance. Also you may use same technique like in Warfare BE: use managed list of all dynamicaly created vehicles.

nearEntities is an ArmA2 command, this question is in the ArmA forums. So if this post was in the wrong area it might work, otherwise it won't work for him. :)

Share this post


Link to post
Share on other sites

And the answer is....

Well, thanks to this forum, and what killed the cat, this is what works...

Create a trigger, any size.

Activation, none./Repeatedly/Present

Condition, true

On Act, this=execVM "empty.sqf" Copy and paste that into the "On Act" section of the trigger.

Done with the trigger.

Ok, now for the script;

Create an "SQF" file. (The program. "ArmA Edit" is good for this.) You will need to put this file into your mission file.

In the SQF file, copy and paste this;

sleep 1260;

_vehicles = nearestObjects [player, ["landvehicle"], 9999];

{

if (count crew vehicle _x == 0) then {deleteVehicle _x};

} forEach _vehicles;

[] execVM "empty.sqf"

Ok, that's it. The time I have set to delete empty vehicles, is set for 1260 (sleep 1260);. About 20 min. You can change that.

And you know what? After 20 min, They're gone! Computers, and the people that write computer scripts, are cool! ( Who can say...)

I needed to know how to do this for a MP game I was making. In my mission, using the script "DAC", too many empty cars were left. Too much lag, too much traffic Too much..

This trigger, this script worked!

And you can see this in my release of "Red Sector A"

Mission download link:

http://www.armaholic.com/page.php?id=18293

Feed back from Nerds, I can eat.

Thanks.

PS. solrac42 Was the best help. Thanks.

Edited by Signalman
  • Like 1

Share this post


Link to post
Share on other sites

Really cool, so simple and that work good i use it via a radio trigger for my server

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

×