Jump to content
Sign in to follow this  
Tajin

Vehicle Respawn with Name & Init

Recommended Posts

Hi Tajin,

I am having trouble cutting this in to my mission. Basically I would like to run coding that is in a players initialization line at mission start and then re-run the same coding after they re-spawn.

I have copied the t-respawn.sqf and have saved it in a folder within my mission folder, I also updated any reference to the "t-respawn.sqf" file.

if (isServer) then {

_obj = _this select 0;

_time = _this select 1;

_delay = _this select 2;

_times = _this select 3;

_vinit = _this select 4;

_pos = getPos _obj;

_dmg = getDammage _obj;

_vup = vectorUp _obj;

_vdir = vectorDir _obj;

_fuel = fuel _obj;

_fire = canFire _obj;

_type = typeOf _obj;

_count = 0;

for [{_loop=0},{(_count <= _delay)},{_loop=_loop}] do

{

if ({alive _x} count crew _obj > 0) then {

_count = 0;

} else {

if (!canMove _obj) then {

_count = _count + 2;

};

if ((getPos _obj distance _pos) > 10) then {

_count = _count + 1;

};

if (_fire && !canFire _obj) then {

_count = _count + 1;

};

if (damage _obj > 0.95) then {

_count = _count + 3;

};

};

sleep 1;

};

_name = vehicleVarName _obj;

if (_name == "") then {

_name = "nul";

};

deleteVehicle _obj;

sleep _time;

if (_times != 0) then {

_times = _times - 1;

_new = _type createVehicle _pos;

_new setPos _pos;

_new setVectorDirAndUp [_vdir,_vup];

_new setDamage _dmg;

_new setFuel _fuel;

nul=[_new,_time,_delay,_times,_vinit] execVM "Cust_scripts\Respawn\t-respawn.sqf";

_new setVehicleInit format["%1 = this;%2;this setVehicleVarName '%1'",_name,_vinit];

processInitCommands;

};

The players initialization line was:-

GrpGOL_1Plt_1st_Squad = group this; nul = ["sl",this] execVM "f\common\@ShackTac_assignGear.sqf";

I have now changed it to:-

nul=[this,20,0,-1,"GrpGOL_1Plt_1st_Squad = group this", "nul = ['sl',this] execVM 'f\common\@ShackTac_assignGear.sqf'"] execVM "Cust_scripts\Respawn\t-respawn.sqf";

I tested this in the editor but no joy, eventually this will go on a dedicated server.

A couple of questions:-

1. Is this script ok to use for what I am after, if yes please can you help?

2. Will this/can this re-spawn the player back at base?

Go gentle with me!!! :bounce3:

Thanks

Cool Breeze

Share this post


Link to post
Share on other sites

I appoligise for jumping in here but this thread looks most likely to be near to our problem. Any help would be most appreciated.

We add several vehicles to our donimation server but when they crash or are destroyed they do not leave their locations on the map. This makes it rather interesting in trying to find and recover them. I do believe we do not need them to respond but rather just show up on the maps so that we might recover them. I can almost invision crashing in the woods or the ocean as I have in the past. Thx for any help.

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  

×