Jump to content
Sign in to follow this  
mattxr

Vrs Vehicle Respawn Help.

Recommended Posts

Ok i have this script which i will post below.

The Objective:

- A Commander Setsdammage to all the air vehicles on the map causing them to have a tail rotor dammage. And since the vehicle name is saved with this script it can be done over and over when the vehicle is respawned. but im having one problem. After the 10 seconds set for the vehicle to respawn it respawns regaurdless if the player is still in there or not. So i was wondering of someone could help me to only start the 10 seconds once the player has got out of the vehcile.

which in SQS format is this code

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@ (isnull driver heli1) && (isnull gunner heli1) && (isnull commander heli1)

so can somehelp me get that into SQF format and add it into this script.

Quote[/b] ]

Start VRS_Move.sqf

*/

private ["_vcl","_respawndelay","_dir","_pos","_type&

quot;,"_run","_delay"];

if (!local Server) exitWith {};

_vcl = _this select 0;

_name_vcl = _this select 1;

_respawndelay = _this select 2;

_dir = Getdir _vcl;

_pos = Getpos _vcl;

_type = typeOf _vcl;

_run = TRUE;

sleep 5;

for [{}, {_run}, {_run}] do

{

while {canMove _vcl} do

{

sleep 1;

_delay = Time + _respawndelay;

};

_delay = Time + _respawndelay;

while {!canMove _vcl && Time < _delay} do

{

sleep 1;

};

if (!canMove _vcl && Time >= _delay) then

{

_name = vehicleVarName _vcl;

deleteVehicle _vcl;

_vcl = _type createVehicle _pos;

if (_name != "") then

{

_vcl setVehicleVarName _name;

call compile format["%1 = _vcl", _name];

// debug

if (vehicleVarName _vcl != _name) then { player sideChat "vehicleVarName does not match "+_name } else { player sideChat "vehicleVarName changed "+_name };

};

_vcl setdir _dir;

sleep 1;

_vcl setvelocity [0,0,0];

_vcl setpos _pos;

sleep 1;

_vcl setvelocity [0,0,0];

sleep 2;

};

};

Any help would be very greatfull. thx

Share this post


Link to post
Share on other sites

EDITED:

Matt try this, I've just updated an earlier version of my modified vrs script and as far as I can tell it seems to work. This script includes a crew check and as long as there are alive crew in a vehicle the vehicle respawn count down won't commence.

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

//**

//** ArmA Script File

//**

//** vrs_AI_general.sqf

//**

//*****************************************************

//** Version 1.1

//BEGIN vrs_AI_general.sqf

//Script by norrin December 2007

//Based upon KaRRiLLioN's original vrs.sqf script heavily modified for use with playable and non-playable AI units

//Contact me at norrins_nook@iprimus.com.au

//to run this script place the following code in the init line of the vehicle:

// v = [this, "vehicle name", x, y] execVM "vrs_AI_general.sqf"

//where x and y are the times you wish to set for the vehicle empty respawn delay and vehicle destroyed respawn delay

//Note: the vehicle name must be in quotation marks eg. if vehicle name Hmm1 it must appear in the init line as "Hmm1"

private ["_vcl","_respawndelay","_vclemptydelay","_dir","_pos","_type","_unit","_run","_wait","_delay","_not_alive"];

if (!isServer) exitWith {};

_vcl = _this select 0;

_name_vcl = _this select 1;

_vclemptydelay = _this select 2;

_respawndelay = _this select 3;

_dir = Getdir _vcl;

_pos = Getpos _vcl;

_type = typeOf _vcl;

_run = TRUE;

sleep 5;

for [{}, {_run}, {_run}] do

{

while {_vcl distance _pos < 5 && canMove _vcl} do

{

sleep 1;

};

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

while {canMove _vcl && count crew _vcl > 0 && count crew _vcl != _not_alive} do

{

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

_wait = Time + _vclemptydelay;

sleep 1;

};

while {canMove _vcl && count crew _vcl < 1 && Time < _wait} do

{

sleep 1;

};

while {canMove _vcl && count crew _vcl == _not_alive && Time < _wait} do

{

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

};

while {!canMove _vcl && count crew _vcl != _not_alive} do

{

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

};

_delay = Time + _respawndelay;

while {!canMove _vcl && count crew _vcl == _not_alive && Time < _delay} do

{

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

};

if (count crew _vcl < 1 || count crew _vcl == _not_alive) then

{

deleteVehicle _vcl;

_vcl = _type createVehicle _pos;

_vcl setdir _dir;

_vcl setpos _pos;

_vcl setVehicleVarName _name_vcl;

player groupchat format ["%1", VehicleVarName _vcl];

sleep 1;

_vcl setvelocity [0,0,0];

sleep 2;

};

sleep 2;

};

Share this post


Link to post
Share on other sites

Thankyou very much nullsystems and Norrin i will test this..

This help wont be forgotton tounge2.gif

Share this post


Link to post
Share on other sites

I added the little fix someone told me to add and the vehicle names do spawn back with the vehicle so i can set dammage them over and over now with no problem.. here is "the lastest version" as you can call it  tounge2.gif

Quote[/b] ]

//

//

//ArmA Script File

//

//    vrs_AI_general.sqf

//

//

//  Version 1.2

//BEGIN vrs_AI_general.sqf

//Script by norrin December 2007

//Based upon KaRRiLLioN's original vrs.sqf script heavily modified for use with playable and non-playable AI units

//Contact me at norrins_nook@iprimus.com.au

//to run this script place the following code in the init line of the vehicle:

// v = [this, "vehicle name", x, y] execVM "vrs_AI_general.sqf"

//where x and y are the times you wish to set for the vehicle empty respawn delay and vehicle destroyed respawn delay

//Note: the vehicle name must be in quotation marks eg. if vehicle name Hmm1 it must appear in the init line as "Hmm1"

private ["_vcl","_respawndelay","_vclemptydelay","_dir",&a

mp;q

uot;_pos","_type","_unit","_run","_wait",&amp

;quo

t;_delay","_not_alive"];

if (!local Server) exitWith {};

_vcl = _this select 0;

_name_vcl = _this select 1;

_vclemptydelay = _this select 2;

_respawndelay = _this select 3;

_dir = Getdir _vcl;

_pos = Getpos _vcl;

_type = typeOf _vcl;

_run = TRUE;

sleep 5;

for [{}, {_run}, {_run}] do

{

while {_vcl distance _pos < 5 && canMove _vcl} do

 {

sleep 1;

 };

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

while {canMove _vcl && count crew _vcl > 0 && count crew _vcl != _not_alive} do  

 {

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

_wait = Time + _vclemptydelay;

sleep 1;

};

while {canMove _vcl && count crew _vcl < 1 && Time < _wait} do

{

sleep 1;

};

while {canMove _vcl && count crew _vcl == _not_alive && Time < _wait} do

{

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

};

while {!canMove _vcl && count crew _vcl != _not_alive} do

 {

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

 };

_delay = Time + _respawndelay;

while {!canMove _vcl && count crew _vcl == _not_alive && Time < _delay} do

 {

_not_alive = 0;

{if (!alive _x) then {_not_alive = _not_alive +1}} forEach crew _vcl;

sleep 1;

 };

if (count crew _vcl < 1 || count crew _vcl == _not_alive) then

 {

 _name = vehicleVarName _vcl;

  deleteVehicle _vcl;

  _vcl = _type createVehicle _pos;

  if (_name != "") then

  {

    _vcl setVehicleVarName _name;

    call compile format["%1 = _vcl", _name];

     // debug

    if (vehicleVarName _vcl != _name) then { player sideChat "vehicleVarName does not match "+_name } else { player sideChat "vehicleVarName changed "+_name };

  };

         _vcl setdir _dir;

         sleep 1;

         _vcl setvelocity [0,0,0];

         _vcl setpos _pos;

         sleep 1;

         _vcl setvelocity [0,0,0];

       sleep 2;

   };

};

When i tested it, it did not work how i wanted and i remebered i had to change something in this area

Quote[/b] ]

_name = vehicleVarName _vcl;

  deleteVehicle _vcl;

  _vcl = _type createVehicle _pos;

  if (_name != "") then

  {

    _vcl setVehicleVarName _name;

    call compile format["%1 = _vcl", _name];

But i managed to do it again. You saved me and my clan aircorps training map notworthy.gif

Many Thanks again.

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  

×