Jump to content
Sign in to follow this  
Gunnykat

Vehicle Respawn with into and custome armorments still intact

Recommended Posts

Ok I found alot of Vehicle respawn scripts but none save the into and armorment load setings I added to them. So what do I do to get these to stay.:confused:

Share this post


Link to post
Share on other sites

Wow how did I miss that one doh thanks. So do you have any maps that you have made you seem to know alot.

Share this post


Link to post
Share on other sites

67 items, 3 missions that are done, not a great percentage here either. :)

Share this post


Link to post
Share on other sites

Ok here is a good question. I need my tow vehicle to come back with this in the into. nul = [this] execVM "tow\mount_vcl_init.sqf"; and with trying to add it like the person who made this respawn script. I get this error. Missing ].

veh = [this, 15, 10, 5, TRUE, FALSE, "this setPosASL [position this select 0, position this select 1, 15.9]; nul = [this] execVM "tow\mount_vcl_init.sqf"; this setDammage 0.5"] execVM "vehicle.sqf";this setPosASL [position this select 0, position this select 1, 15.9];nul = [this] execVM "tow\mount_vcl_init.sqf";

Edited by Gunnykat

Share this post


Link to post
Share on other sites

Try double "", around the script names, like ""tow\mount_vcl_init.sqf""

Share this post


Link to post
Share on other sites

Ok I did that but still a Missing ] error

veh = [this, 15, 10, 5, TRUE, FALSE, "nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf""this setPosASL [position this select 0, position this select 1, 15.9]"] execVM "vehicle.sqf"this setPosASL [position this select 0, position this select 1, 15.9];nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf";

Edited by Gunnykat

Share this post


Link to post
Share on other sites

Applied to all script name obviously, they are strings inside a string basically. You are missing semicolons between thing as well.

Share this post


Link to post
Share on other sites

veh = [this, 15, 10, 5, TRUE, FALSE, "this setPosASL [position this select 0, position this select 1, 15.9]; nul = [this] execVM ""tow\mount_vcl_init.sqf""; this setDammage 0.5"] execVM "vehicle.sqf";
this setPosASL [position this select 0, position this select 1, 15.9];
nul = [this] execVM "tow\mount_vcl_init.sqf";

Edit: Oh, you changed the code again, this is your updated code, notice that anything BETWEEN " " needs double quotes, or use single quotes instead:

veh = [this, 15, 10, 5, TRUE, FALSE, "nul = [this,'car'] execVM 'mountOnC130\mount_vcl_init.sqf'; this setPosASL [position this select 0, position this select 1, 15.9]"] execVM "vehicle.sqf";
this setPosASL [position this select 0, position this select 1, 15.9];
nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf";

Edited by kylania

Share this post


Link to post
Share on other sites

Ack now when I start load lifting my moble HQ with my Sea Hawk a missle comes out of no where and blows it up lol. Must have something to do with his spawn script.

Edited by Gunnykat

Share this post


Link to post
Share on other sites

nope its the tow missle animation he has to make explosion befor respawn. There are no Enemys on this map yet.

Edited by Gunnykat

Share this post


Link to post
Share on other sites

Ahh, right, change your code to this:

veh = [this, 15, 18000, 0, FALSE, FALSE, "nul = [this,'car'] execVM 'mountOnC130\mount_vcl_init.sqf'; this setPosASL [position this select 0, position this select 1, 15.9]"] execVM "vehicle.sqf";
this setPosASL [position this select 0, position this select 1, 15.9];
nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf";

That will give you 15 seconds after destruction till it respawns, 5 hours of idle time on the ground (you had it at 10 seconds abandoned, which it would be while towing) and the first FALSE there turns off the explosive respawn. :) I also changed it from 5 limited respawns to unlimited.

Share this post


Link to post
Share on other sites

lol doh

man I read it as close as I could. When will I catch on to this codeing lol. You are the most help in the world. I can't wait till Mr. Murry puts out his book on Arma 2 scripting. Cause I am not sure how much is still like Arma. I sure have learnd alot this week ty.

Share this post


Link to post
Share on other sites

Ok did the change same thing its only when I get it in the air. I wonder if its something in the main script.

/*  
=========================================================
 Simple Vehicle Respawn Script v1.6
 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 = [this, Delay, Deserted timer, Respawns, Effect, Static] 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 put the respawn delay, then the deserted vehicle timer-
 Like this:  
 veh = [this, 15, 10] execVM "vehicle.sqf"

 By default the number of respawns is infinite. To set a limit
 First set the other 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 the other 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: harlechin@hotmail.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 ((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_TOW_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;};
};
};

---------- Post added at 02:55 AM ---------- Previous post was at 02:46 AM ----------

Doh I think I found it lol. I had to put the same time on the HQ not just the choper lol. duh. I think its all good now.

Share this post


Link to post
Share on other sites

I'm having 1.7 of that script out this weekend. Not a big change but just thought I'd tell you. Happy to see you got it working.

Share this post


Link to post
Share on other sites

Thx Kylania. And thanks for the PM feedback. We're on the same track...

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  

×