Jump to content
Sign in to follow this  
tophe

Simple Vehicle Respawn Script [Arma3]

Recommended Posts

Never use SP or the SP editor, I always use MP so can't say why it doesn't work using SP. Maybe someone else can come up with the answer?

Remember though the example scripts don't do anything other than show hints to prove the inits come back after respawn as at the time I didn't have the scripts that were used and didn't feel like creating something :)

Share this post


Link to post
Share on other sites

I think it might be because of the netID, which doesn't seem to do anything in editor or SP.

I'm using your scripts with the mark_units and various other scripts to control locking controls. Works like a charm

Share this post


Link to post
Share on other sites

Ok! So i shearched, and shearched again, and again....

And my vehicle rspawn script's problem comes from of a game bug!

Yes, and this is my proof :

http://www.fileswap.com/dl/kr9jNo9TO/

http://www.fileswap.com/dl/xRcYTy9NYF/

The script is good on stratis island, but not on pythos island!! Why i don't know!

You can find here, 2 ultra simple maps with the same vehicles and same men! I just pasted the same unit and ammobox from "pythos", on stratis beach!

=> in the first case : the respawn isn't good!

=> in the second case : everything is ok!

Can someone verify this issue, and if it's confirmed, report it with technical words to bohemia!

Thanks all ;)

Share this post


Link to post
Share on other sites

It seems that respawn vehicle make bug when it's done on "pythos" island (at NE)!!

I have too ultra simple demo, which proove it! The same unit and same vehicle pasted from pythos to stratis beach!

On pythos : respawn isn't good! :(

On Stratis, everything is OK!

That were my problem since the beginning! :(

EDIT : this is a double post, because the first one didn't appeared when i tried 2 times to post it! I thought it was because of the links!

Sorry!

Edited by chal00
problem with post

Share this post


Link to post
Share on other sites

Ok can someone help me out. I tried doing Tophe Script and I keep getting error line 116. Then I tried using the other one provided in here, when I preview it nothing at all happens. WTF am I doing wrong?

Share this post


Link to post
Share on other sites

Simple Vehicle Respawn Script v1.81 for Arma 3

by Tophe of Östgöta Ops [OOPS]

Put this in the vehicles init line:

veh = [this] execVM "vehicle.sqf"

Options:

There are some optional settings. The format for these are:

veh = [object, Delay, Deserted timer, Respawns, Effect, Dynamic] execVM "vehicle.sqf"

Default respawn delay is 30 seconds, to set a custom respawn delay time, put that in the init as well.

Like this:

veh = [this, 15] execVM "vehicle.sqf"

Default respawn time when vehicle is deserted, but not destroyed is 120 seconds. To set a custom timer for this

first set respawn delay, then the deserted vehicle timer. (0 = disabled)

Like this:

veh = [this, 15, 10] execVM "vehicle.sqf"

By default the number of respawns is infinite. To set a limit first set preceding values then the number of respawns you want (0 = infinite).

Like this:

veh = [this, 15, 10, 5] execVM "vehicle.sqf"

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.

Like this:

veh = [this, 15, 10, 5, TRUE] execVM "vehicle.sqf"

By default the vehicle will respawn to the point where it first was when the mission started (static).

This can be changed to dynamic. Then the vehicle will respawn to the position where it was destroyed.

First set all preceding values then set TRUE for dynamic or FALSE for static.

Like this:

veh = [this, 15, 10, 5, TRUE, TRUE] execVM "vehicle.sqf"

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.

Like this:

veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

Default values of all settings are:

veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf"

Contact & Bugreport: cwadensten@gmail.com

================================================================================================================== */

if (!isServer) exitWith {};

// Define variables

_unit = _this select 0;

_delay = if (count _this > 1) then {_this select 1} else {30};

_deserted = if (count _this > 2) then {_this select 2} else {120};

_respawns = if (count _this > 3) then {_this select 3} else {0};

_explode = if (count _this > 4) then {_this select 4} else {false};

_dynamic = if (count _this > 5) then {_this select 5} else {false};

_unitinit = if (count _this > 6) then {_this select 6} else {};

_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;

_unitname = vehicleVarName _unit;

if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};

_noend = true;

_run = true;

_rounds = 0;

if (_delay < 0) then {_delay = 0};

if (_deserted < 0) then {_deserted = 0};

if (_respawns <= 0) then {_respawns= 0; _noend = true;};

if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;

_position = getPosASL _unit;

_type = typeOf _unit;

_dead = false;

_nodelay = false;

// Start monitoring the vehicle

while {_run} do

{

sleep (2 + random 10);

if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.

if (_deserted > 0) then

{

if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then

{

_timeout = time + _deserted;

sleep 0.1;

waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};

if ({alive _x} count crew _unit > 0) then {_dead = false};

if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true};

if !(alive _unit) then {_dead = true; _nodelay = false};

};

};

// Respawn vehicle

if (_dead) then

{

if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};

if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};

if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};

sleep 0.1;

deleteVehicle _unit;

sleep 2;

_unit = _type createVehicle _position;

_unit setPosASL _position;

_unit setDir _dir;

if (_haveinit) then

{_unit setVehicleInit format ["%1;", _unitinit];

processInitCommands;};

if (_hasname) then

{_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];

processInitCommands;};

_dead = false;

// Check respawn amount

if !(_noend) then {_rounds = _rounds + 1};

if ((_rounds == _respawns) and !(_noend)) then {_run = false;};

};

};

I got error message in game..something wrong with Vehicle.Sqf???????

---------- Post added at 09:11 ---------- Previous post was at 08:28 ----------

I found it...it worked

use this

if (!isServer) exitWith {};

// Define variables

_unit = _this select 0;

_delay = if (count _this > 1) then {_this select 1} else {30};

_deserted = if (count _this > 2) then {_this select 2} else {120};

_respawns = if (count _this > 3) then {_this select 3} else {0};

_explode = if (count _this > 4) then {_this select 4} else {false};

_dynamic = if (count _this > 5) then {_this select 5} else {false};

_unitinit = if (count _this > 6) then {_this select 6} else {};

_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;

_unitname = vehicleVarName _unit;

if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};

_noend = true;

_run = true;

_rounds = 0;

if (_delay < 0) then {_delay = 0};

if (_deserted < 0) then {_deserted = 0};

if (_respawns <= 0) then {_respawns= 0; _noend = true;};

if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;

_position = getPosASL _unit;

_type = typeOf _unit;

_dead = false;

_nodelay = false;

// Kronzky's code

KRON_StrToArray = {

private["_in","_i","_arr","_out"];

_in=_this select 0;

_arr = toArray(_in);

_out=[];

for "_i" from 0 to (count _arr)-1 do {

_out=_out+[toString([_arr select _i])];

};

_out

};

KRON_StrLen = {

private["_in","_arr","_len"];

_in=_this select 0;

_arr=[_in] call KRON_StrToArray;

_len=count (_arr);

_len

};

KRON_Replace = {

private["_str","_old","_new","_out","_tmp","_jm","_la","_lo","_ln","_i"];

_str=_this select 0;

_arr=toArray(_str);

_la=count _arr;

_old=_this select 1;

_new=_this select 2;

_na=[_new] call KRON_StrToArray;

_lo=[_old] call KRON_StrLen;

_ln=[_new] call KRON_StrLen;

_out="";

for "_i" from 0 to (count _arr)-1 do {

_tmp="";

if (_i <= _la-_lo) then {

for "_j" from _i to (_i+_lo-1) do {

_tmp=_tmp + toString([_arr select _j]);

};

};

if (_tmp==_old) then {

_out=_out+_new;

_i=_i+_lo-1;

} else {

_out=_out+toString([_arr select _i]);

};

};

_out

};

// End of Kronzky's code

// Start monitoring the vehicle

while {_run} do

{

sleep (2 + random 10);

if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.

if (_deserted > 0) then

{

if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then

{

_timeout = time + _deserted;

sleep 0.1;

waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};

if ({alive _x} count crew _unit > 0) then {_dead = false};

if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true};

if !(alive _unit) then {_dead = true; _nodelay = false};

};

};

// Respawn vehicle

if (_dead) then

{

if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};

if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};

if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};

sleep 0.1;

deleteVehicle _unit;

sleep 2;

_unit = _type createVehicle _position;

_unit setPosASL _position;

_unit setDir _dir;

if (_haveinit) then {

//_unit setVehicleInit format ["%1;", _unitinit];

//processInitCommands;

// Modified by BearBison

private ["_IDunit", "_sCommand"];

_IDunit = format["(objectFromNetID '%1')", netID _unit];

_sCommand=[format["%1",_unitinit],"this",format["%1",_IDunit]] call KRON_Replace;

// End of code modified by BearBison

// Modified by naong and AgentRev

[call compile format["[{%1}]",_sCommand], "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;

};

if (_hasname) then {

//_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];

//processInitCommands;

private "_sCommand";

_sCommand = format["[{(objectFromNetID '%1') setVehicleVarName '%2';}]", netID _unit, _unitname];

[call compile format["%1",_sCommand],"BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;

_unit call compile format ["%1=_This; PublicVariable '%1'",_unitname];

};

// End of code modified by naong

_dead = false;

// Check respawn amount

if !(_noend) then {_rounds = _rounds + 1};

if ((_rounds == _respawns) and !(_noend)) then {_run = false;};

};

};

---------- Post added at 09:14 ---------- Previous post was at 09:11 ----------

Ok can someone help me out. I tried doing Tophe Script and I keep getting error line 116. Then I tried using the other one provided in here, when I preview it nothing at all happens. WTF am I doing wrong?

Tophe Script dont work..i try i got error messge too

i found it another script

use this

if (!isServer) exitWith {};

// Define variables

_unit = _this select 0;

_delay = if (count _this > 1) then {_this select 1} else {30};

_deserted = if (count _this > 2) then {_this select 2} else {120};

_respawns = if (count _this > 3) then {_this select 3} else {0};

_explode = if (count _this > 4) then {_this select 4} else {false};

_dynamic = if (count _this > 5) then {_this select 5} else {false};

_unitinit = if (count _this > 6) then {_this select 6} else {};

_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;

_unitname = vehicleVarName _unit;

if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};

_noend = true;

_run = true;

_rounds = 0;

if (_delay < 0) then {_delay = 0};

if (_deserted < 0) then {_deserted = 0};

if (_respawns <= 0) then {_respawns= 0; _noend = true;};

if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;

_position = getPosASL _unit;

_type = typeOf _unit;

_dead = false;

_nodelay = false;

// Kronzky's code

KRON_StrToArray = {

private["_in","_i","_arr","_out"];

_in=_this select 0;

_arr = toArray(_in);

_out=[];

for "_i" from 0 to (count _arr)-1 do {

_out=_out+[toString([_arr select _i])];

};

_out

};

KRON_StrLen = {

private["_in","_arr","_len"];

_in=_this select 0;

_arr=[_in] call KRON_StrToArray;

_len=count (_arr);

_len

};

KRON_Replace = {

private["_str","_old","_new","_out","_tmp","_jm","_la","_lo","_ln","_i"];

_str=_this select 0;

_arr=toArray(_str);

_la=count _arr;

_old=_this select 1;

_new=_this select 2;

_na=[_new] call KRON_StrToArray;

_lo=[_old] call KRON_StrLen;

_ln=[_new] call KRON_StrLen;

_out="";

for "_i" from 0 to (count _arr)-1 do {

_tmp="";

if (_i <= _la-_lo) then {

for "_j" from _i to (_i+_lo-1) do {

_tmp=_tmp + toString([_arr select _j]);

};

};

if (_tmp==_old) then {

_out=_out+_new;

_i=_i+_lo-1;

} else {

_out=_out+toString([_arr select _i]);

};

};

_out

};

// End of Kronzky's code

// Start monitoring the vehicle

while {_run} do

{

sleep (2 + random 10);

if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.

if (_deserted > 0) then

{

if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then

{

_timeout = time + _deserted;

sleep 0.1;

waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};

if ({alive _x} count crew _unit > 0) then {_dead = false};

if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true};

if !(alive _unit) then {_dead = true; _nodelay = false};

};

};

// Respawn vehicle

if (_dead) then

{

if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};

if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};

if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};

sleep 0.1;

deleteVehicle _unit;

sleep 2;

_unit = _type createVehicle _position;

_unit setPosASL _position;

_unit setDir _dir;

if (_haveinit) then {

//_unit setVehicleInit format ["%1;", _unitinit];

//processInitCommands;

// Modified by BearBison

private ["_IDunit", "_sCommand"];

_IDunit = format["(objectFromNetID '%1')", netID _unit];

_sCommand=[format["%1",_unitinit],"this",format["%1",_IDunit]] call KRON_Replace;

// End of code modified by BearBison

// Modified by naong and AgentRev

[call compile format["[{%1}]",_sCommand], "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;

};

if (_hasname) then {

//_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];

//processInitCommands;

private "_sCommand";

_sCommand = format["[{(objectFromNetID '%1') setVehicleVarName '%2';}]", netID _unit, _unitname];

[call compile format["%1",_sCommand],"BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;

_unit call compile format ["%1=_This; PublicVariable '%1'",_unitname];

};

// End of code modified by naong

_dead = false;

// Check respawn amount

if !(_noend) then {_rounds = _rounds + 1};

if ((_rounds == _respawns) and !(_noend)) then {_run = false;};

};

};

Share this post


Link to post
Share on other sites

Hey i suggest that you edit your post and wrap spoiler tags around it.

However, Thanks for the post!!

Share this post


Link to post
Share on other sites

Guys, I'm not sure what I'm doing wrong.

I create the Quadbikes that I want to respawn, put the init field veh = [this, 15, 10, TRUE] execVM "vehicle.sqf" have put veh.sqf in the root folder of the mission, but when I start it up there's a small black square with script in it in white writing, then the respawn doesn't work.

Anyone know what I've done wrong here?

Share this post


Link to post
Share on other sites

SgtWilson,

You are missing a parameter.

Re read the start of the vehicle.sqf, it shows

veh = [this, 15, 10, 5, true] execVM "vehicle.sqf';

You are missing the value for number of respawns. - leave as 0 (zero) for infinite (the 5 above).

BTW, that black box is your friend when it comes to scripting - it shows you all errors and where they are in which script.

Edited by KevsnoTrev
corrected bad english - sue me i was born in the UK never learned to speak proper ......lol

Share this post


Link to post
Share on other sites

I cannot find the Vehicle Init file to add this line. Might someone help me apply this output into my code veh = [_this, 10, 0, 0, TRUE, FALSE] execVM "vehicle.sqf"

I am thinking i have to place it within this code:

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

ASSIGN DAMAGE HANDLER TO A UNIT

- Function set_EH

- unit call set_EH;

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

private["_unit","_eh1","_eh2","_dir","_location"];

_unit = _this;

_dir = getdir _this;

_location = getPosATL _this;

//Assign event handlers

_eh1 = _unit addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];

_eh2 = _unit addeventhandler ["Killed",{ _this call vehicle_handleKilled } ];

//diag_log format ["set EH %1 for vehicle:%2", _eh1, typeOf _unit ];

if (isServer) then {

_eh3 = _unit addEventHandler ["GetOut", {[(_this select 0),"all"] call server_updateObject;}];

_eh4 = _unit addEventHandler ["GetIn", {[(_this select 0),"all"] call server_updateObject;}];

_eh5 = _unit addEventHandler ["Killed",{ _this call vehicle_handleKilled } ];

_eh6 = _unit addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];

veh = [_this, 10, 0, 0, TRUE, FALSE] execVM "vehicle.sqf"

};

---------- Post added at 11:44 ---------- Previous post was at 11:40 ----------

where do i put within my code veh = [_this, 10, 0, 0, TRUE, FALSE] execVM "vehicle.sqf"

---------- Post added at 13:35 ---------- Previous post was at 11:44 ----------

I am using Lingor.. I do not know if this script works for lingor dayz

Share this post


Link to post
Share on other sites

@ frostey007-This code goes in the vehicle init box when your in the editor

veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

is that what you mean ?

Share this post


Link to post
Share on other sites

sorry for a stupid question...but may it be that the latest Game Version is avoiding the script to work properly?

I am using the ArmA2 Version of this script in ArmA2 Missions a lot and they work great. But I cant get the 1.81 Version for ArmA3 to work...the Vehicles simply don't respawn...does someone have any Ideas about that?

The script file is located in the Missions folder, I am using this in the init line of each Vehicle:

veh = [this] execVM "vehicle.sqf";

But no success so far.

Share this post


Link to post
Share on other sites
sorry for a stupid question...but may it be that the latest Game Version is avoiding the script to work properly?

I am using the ArmA2 Version of this script in ArmA2 Missions a lot and they work great. But I cant get the 1.81 Version for ArmA3 to work...the Vehicles simply don't respawn...does someone have any Ideas about that?

The script file is located in the Missions folder, I am using this in the init line of each Vehicle:

veh = [this] execVM "vehicle.sqf";

But no success so far.

As was said in earlyer post, in Arma 3 the script does not work correctly. Use the one suggested instead. I tried it and it worked :satisfied:

Tophe Script dont work..i try i got error messge too

i found it another script

use this

if (!isServer) exitWith {};

// Define variables
_unit = _this select 0;
_delay = if (count _this > 1) then {_this select 1} else {30};
_deserted = if (count _this > 2) then {_this select 2} else {120};
_respawns = if (count _this > 3) then {_this select 3} else {0};
_explode = if (count _this > 4) then {_this select 4} else {false};
_dynamic = if (count _this > 5) then {_this select 5} else {false};
_unitinit = if (count _this > 6) then {_this select 6} else {};
_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;
_unitname = vehicleVarName _unit;
if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};
_noend = true;
_run = true;
_rounds = 0;

if (_delay < 0) then {_delay = 0};
if (_deserted < 0) then {_deserted = 0};
if (_respawns <= 0) then {_respawns= 0; _noend = true;};
if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;
_position = getPosASL _unit;
_type = typeOf _unit;
_dead = false;
_nodelay = false;

// Kronzky's code
KRON_StrToArray = {
   private["_in","_i","_arr","_out"];
   _in=_this select 0;
   _arr = toArray(_in);
   _out=[];
   for "_i" from 0 to (count _arr)-1 do {
       _out=_out+[toString([_arr select _i])];
   };
   _out
};

KRON_StrLen = {
   private["_in","_arr","_len"];
   _in=_this select 0;
   _arr=[_in] call KRON_StrToArray;
   _len=count (_arr);
   _len
};

KRON_Replace = {
   private["_str","_old","_new","_out","_tmp","_jm","_la","_lo","_ln","_i"];
   _str=_this select 0;
   _arr=toArray(_str);
   _la=count _arr;
   _old=_this select 1;
   _new=_this select 2;
   _na=[_new] call KRON_StrToArray;
   _lo=[_old] call KRON_StrLen;
   _ln=[_new] call KRON_StrLen;
   _out="";
   for "_i" from 0 to (count _arr)-1 do {
       _tmp="";
       if (_i <= _la-_lo) then {
           for "_j" from _i to (_i+_lo-1) do {
               _tmp=_tmp + toString([_arr select _j]);
           };
       };
       if (_tmp==_old) then {
           _out=_out+_new;
           _i=_i+_lo-1;
       } else {
           _out=_out+toString([_arr select _i]);
       };
   };
   _out
};
// End of Kronzky's code

// Start monitoring the vehicle
while {_run} do 
{    
   sleep (2 + random 10);
     if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

   // Check if the vehicle is deserted.
   if (_deserted > 0) then
   {
       if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then 
       {
           _timeout = time + _deserted;
           sleep 0.1;
            waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};
           if ({alive _x} count crew _unit > 0) then {_dead = false}; 
           if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; 
           if !(alive _unit) then {_dead = true; _nodelay = false}; 
       };
   };

   // Respawn vehicle
     if (_dead) then 
   {    
       if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};
       if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
       if (_explode) then {_effect = "M_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};
       sleep 0.1;

       deleteVehicle _unit;
       sleep 2;
       _unit = _type createVehicle _position;
       _unit setPosASL _position;
       _unit setDir _dir;
       if (_haveinit) then {
           //_unit setVehicleInit format ["%1;", _unitinit];
           //processInitCommands;
           // Modified by BearBison
           private ["_IDunit", "_sCommand"];
           _IDunit = format["(objectFromNetID '%1')", netID _unit];
           _sCommand=[format["%1",_unitinit],"this",format["%1",_IDunit]] call KRON_Replace;
           // End of code modified by BearBison
           // Modified by naong and AgentRev
           [call compile format["[{%1}]",_sCommand], "BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
       };
       if (_hasname) then {
           //_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];
           //processInitCommands;
           private "_sCommand";
           _sCommand = format["[{(objectFromNetID '%1') setVehicleVarName '%2';}]", netID _unit, _unitname];
           [call compile format["%1",_sCommand],"BIS_fnc_spawn", true, true] spawn BIS_fnc_MP;
           _unit call compile format ["%1=_This; PublicVariable '%1'",_unitname];
       };
       // End of code modified by naong
       _dead = false;

       // Check respawn amount
       if !(_noend) then {_rounds = _rounds + 1};
       if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
   };
};

Share this post


Link to post
Share on other sites

Hey guys.. Sorry for my absence. I've been working a lot lately. This kind of caught me off guard, and I'mm looking at some kind of solution. Naong seems to be on to something, but I can't seem to iron it out. Looking a bit at it now.

Share this post


Link to post
Share on other sites
As was said in earlyer post, in Arma 3 the script does not work correctly. Use the one suggested instead. I tried it and it worked :satisfied:

hey, it works...awesome...thanks a lot.

Share this post


Link to post
Share on other sites

Hello,

I'm just having a bit of difficulty at the moment trying to insert into the "init" field for this script.

veh = [this, 15, 10, 5, TRUE, FALSE, "init field here"] execVM "vehicle.sqf"

Only issue is the code I want to insert is the following:

this addAction["Insert Smoke","smoke.sqf"];

Basically when the MH9 respawns, I want it to continue to have the option to drop smoke but this is causing me issues, if you just straight put that addaction between the two quotation marks, it just doesn't work. Missing [. Can someone please tell me how to code these two together or let me know if the addaction function just cannot be inserted there?

NINJA EDIT Also is there a way to retain the name of vehicles? I have markers set on my vehicles but obviously when destroyed, they lose all that information and thus also the markers.

Cheers

Sweetbix

Edited by Sweetbix

Share this post


Link to post
Share on other sites

try this

veh = [this, 15, 10, 5, TRUE, FALSE, "this addAction[""Insert Smoke"",""smoke.sqf""];"] execVM "vehicle.sqf";this addAction["Insert Smoke","smoke.sqf"];

you have to have the initialisation field contain the script to run and the one ot use on respawn. That's why its in there twice.

Share this post


Link to post
Share on other sites

Thanks for the reply Kevsno,

But unfortunately the same outcome. Works initially but after the respawn it's a no go.

Share this post


Link to post
Share on other sites

is there any way to make this also work for boats around the island pythos?

the rest of the map works fine. but for boats arround pythos findsafepos seems to fail :(

Error in expression <_minDist) then
{
if (!((count (_testPos isFlatEmpty [_objDist, 0, _maxGradient, >
 Error position: <isFlatEmpty [_objDist, 0, _maxGradient, >
 Error Type Any, expected Number
File A3\functions_f\misc\fn_findSafePos.sqf, line 100

Share this post


Link to post
Share on other sites

@Sweetbix

See my post from earlier with a modified version of the script and a slightly different method of calling it that works in a MP environment (our group have used this on all of our missions without issue). Note that my example demo mission only calls scripts that have hints in them and not true actions as it was only a POC mission for one of the others.

Edited by BearBison
link to post

Share this post


Link to post
Share on other sites

Thanks BearBison, your version of the script is working like a charm. No issues yet.

Share this post


Link to post
Share on other sites

I noticed this script won't respawn vehicle locked (if set "locked" as default).

Anyway to included the vehicle lock upon respawn?

Share this post


Link to post
Share on other sites

Hey Tophe,

please check the script. It doesn't work in the Beta (Ok, I´ve got to admit that the Beta is out since of today )...But just for the case...

this is the error message that appears right at mission start

if (_haveinit) then 
{_unit setVehicleInit format ["%1;", _unitinit]>
 Error position: <setVehicleInit format ["%1;", _unitinit]>
 Error Missing ;
File C:\Users\Memphis\Documents\Arma 3 - Other Profiles\MemphisBelle\mpmissions\SVR.Stratis\vehicle.sqf, line 116
Error in expression <tDir _dir;

Share this post


Link to post
Share on other sites
Hey Tophe,

please check the script. It doesn't work in the Beta (Ok, I´ve got to admit that the Beta is out since of today )...But just for the case...

this is the error message that appears right at mission start

if (_haveinit) then 
{_unit setVehicleInit format ["%1;", _unitinit]>
 Error position: <setVehicleInit format ["%1;", _unitinit]>
 Error Missing ;
File C:\Users\Memphis\Documents\Arma 3 - Other Profiles\MemphisBelle\mpmissions\SVR.Stratis\vehicle.sqf, line 116
Error in expression <tDir _dir;

setVehicleInit = probably you are using an old version of his script?

Since the hack week, they fix an hole with this command by removing it.

the new script uses something like BIS_fnc_MP now instead of setvehicleInit.

look in this thread around page 5 post #44

Edited by holo89
adding references

Share this post


Link to post
Share on other sites
setVehicleInit = probably you are using an old version of his script?

well actually not, I was using a new downloaded script

Since the hack week, they fix an hole with this command by removing it.

the new script uses something like BIS_fnc_MP now instead of setvehicleInit.

look in this thread around page 5 post #44

sorry, which thread are you referring to? did you forgot to set the link?

regards

Memphis

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  

×