Home   Help Search Login Register  

Author Topic: Simple Vehicle Respawn Script v1.7 (ACCEPTED)  (Read 2947 times)

0 Members and 1 Guest are viewing this topic.

Offline Tophe

  • Members
  • *
Simple Vehicle Respawn Script v1.7 (ACCEPTED)
« on: 15 Jul 2009, 23:20:54 »
This script will respawn a vehicle when it is destroyed or left empty in the battlefield.
It will be respawned to the position where it first stood when the mission started.
Works with any vehicle.

Just put this in the vehicles init line:
Code: [Select]
veh = [this] execVM "vehicle.sqf"
Default settings are:
30 seconds respawn delay after destruction
120 seconds respawn delay after deserting a vehicle (leaving it empty after driving it).
Unlimited respawns
No special effect when respawning
Static respawn.


OPTIONS:
There are some optional settings. The format for these are:
Code: [Select]
veh = [this, Delay, Deserted timer, Respawns, Effect, Static, "INIT"] execVM "vehicle.sqf"If you don't use any additional settings the default settings will be used, they look like this:
Code: [Select]
veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf"

Respawn Delay:
Default respawn delay is 30 seconds, to set a custom respawn delay time, put that in the init as well.
This one will respawn in 15 seconds:
Code: [Select]
veh = [this, 15] execVM "vehicle.sqf"Deserted Vehicle Respawn:
Default respawn time when vehicle is deserted, but not destroyed is 120 seconds.
To set a custom timer for this first put the respawn delay, then the deserted vehicle timer.
The value 0 will disable the timer and the vehicle will not respawn when deserted.
This one will respawn in 15 seconds if destroy, and in 50 seconds if left empty in the field.
Code: [Select]
veh = [this, 15, 50] execVM "vehicle.sqf"Respawn limit:
By default the number of respawns is unlimited. To set a limit, first set the other values
then the number of respawns you want (0 = infinite).
Code: [Select]
veh = [this, 15, 10, 5] execVM "vehicle.sqf"Effect:
Set this value to TRUE to add a special explosion effect to the wreck when respawning.
Default value is FALSE, which will simply have the wreck disappear.
Code: [Select]
veh = [this, 15, 10, 5, TRUE] execVM "vehicle.sqf"Dynamic Respawn:
By default the vehicle will respawn to the point where it first was when the mission started (static). This can be changed to dynamic.
Set it to TRUE to get the vehicle to respawn to the position where it was destroyed. FALSE makes it use the default static setting.
Code: [Select]
veh = [this, 15, 10, 5, FALSE, TRUE] execVM "vehicle.sqf"INIT field:
If you you want to set the INIT field of the respawned vehicle, first set all other
values, then set init commands. Those must be inside quotations.
Code: [Select]
veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"
Change log:

v1.7
* Added function to disable deserted vehicle respawn.

v1.6
* Fixed serious bug introduced in v1.5, where respawn timer was disabled.
* The script will no longer try reset name of vehicles originally unnamed.
* Added check if deserted vehicle is destroyed.

v1.5
* Option to set the INIT of the respawned vehicle.
* Vehicle now respawns with original name.

v1.4
* Fixed some bad code that ended up in error codes. Script should be less heavy now. (thanks Xeno!)
* Fixed bug where a vehicle that moved by an explosion would trigger the deserted timer.

v1.3:
* Support added for vehicles placed on the LHD (with setPosASL).
* Added optional respawn limit.
* Added optional respawn effect (explosion).
* Better damage checking. Now the vehicles shouldn't respawn when units are in them.

v1.2:

* Script now fully support any vehicle, including bícycles.
* Fixed positioning for vehicles close to other objects.
* Improved stability. The script runs much better with large amounts of vehicles.

v1.1:
* Rewrote most of the the script.
* Added respawn for vehicles left empty in the field. The delay can be set.
* Added dynamic respawn option. The vehicles can now be spawned where it was destroyed.

v1.0

* First release.


Future plans:
The dynamic setting is experimental. Works fine on land, but might cause trouble if a vehicle
crashes into water. This will be fixed in a future version.

OFPEC DOWNLOAD
« Last Edit: 25 Sep 2009, 07:12:38 by Tophe »

Offline Tophe

  • Members
  • *
Re: Simple Vehicle Respawn Script v1.7 (ACCEPTED)
« Reply #1 on: 25 Sep 2009, 14:27:36 »
Updated to 1.7

Offline ZachHox

  • Members
  • *
Re: Simple Vehicle Respawn Script v1.7 (ACCEPTED)
« Reply #2 on: 02 Nov 2009, 02:29:14 »
Hi Tophe,

Would this script work with ArmA1? If not, do you have or know of a similar script for arma1?

If so, how can I put it in the init.sqf file and for example use this for any vehicles of my choice?:

Code: [Select]
{veh = [_x, Delay, Deserted timer, Respawns, Effect, Static, "INIT"] execVM "vehicle.sqf"} foreach [vehicle1, vehicle2, vehicle3, vehicle4....]


Thanks.
« Last Edit: 02 Nov 2009, 02:32:30 by ZachHox »