callmesarge 7 Posted September 6, 2014 Thanks Beerkan - I tried this, but it did not work - is the position of the code incorrect? if (_dead) then { deleteVehicle _veh; sleep 1; _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setDir _dir; _veh setVehicleVarName "MHQ1"; [_veh,"Fnc_MPAddVASAction",nil,true] spawn BIS_fnc_MP; }; if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1"}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2"}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3"}; Share this post Link to post Share on other sites
Beerkan 71 Posted September 6, 2014 Thanks Beerkan - I tried this, but it did not work - is the position of the code incorrect?..Not quite. Here's what it should look like. if (_dead) then { deleteVehicle _veh; sleep 1; _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setDir _dir; [_veh,"Fnc_MPAddVASAction",nil,true] spawn BIS_fnc_MP; if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3";}; }; Note I've removed this bit _veh setVehicleVarName "MHQ1"; as leaving it in would set this for every vehicle respawned. ---------- Post added at 09:27 PM ---------- Previous post was at 09:09 PM ---------- If that doesn't work try this... if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {missionNamespace setVariable ["MHQ1", _veh];publicVariable "MHQ1";}; Share this post Link to post Share on other sites
callmesarge 7 Posted September 6, 2014 Whoops, sloppy on my part. I tried this out, but I am still doing something wrong. If I comment the three lines out like this: //if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1";}; //if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2";}; //if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3";}; the script runs fine. With them in, it stops the respawn from happening. What have I done wrong here? /* ---------------------------------------------------------------------------------------------------- File: vehRespawn.sqf Author: Iceman77 Description: Respawn destroyed and abandoned vehicles Parameter(s): _this select 0: vehicle _this select 1: abandoned delay in minute(s) - Required _this select 2: destroyed delay in minute(s) - Required How to use - Vehicle Init Line: _nul = [this, 2, 1] execVM "vehrespawn.sqf"; << 2 minute abandoned delay, 1 minute destroyed delay. ---------------------------------------------------------------------------------------------------- */ private "_veh"; _veh = _this select 0; _abandonDelay = (_this select 1) * 7200; _deadDelay = (_this select 1) * 10; _dir = getDir _veh; _pos = getPos _veh; _vehtype = typeOf _veh; if (isServer) then { While {True} Do { sleep 1; if ((alive _veh) && {canMove _veh} && {{alive _x} count crew _veh == 0}) then { _abandoned = true; for "_i" from 0 to _abandonDelay do { if (({alive _x} count (crew _veh) > 0) || (!alive _veh) || (!canMove _veh)) exitWith {_abandoned = false;}; sleep 1; }; if ((_abandoned) && {_veh distance _pos > 10}) then { deleteVehicle _veh; sleep 1; _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setDir _dir; _veh setPos [_pos select 0, _pos select 1,0]; }; }; if ((!alive _veh) || (!canMove _veh)) then { _dead = true; for "_i" from 0 to _deadDelay do { if (({alive _x} count (crew _veh) > 0) || (canMove _veh)) exitWith {_dead = false;}; sleep 1; }; if (_dead) then { deleteVehicle _veh; sleep 1; _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setDir _dir; [_veh,"Fnc_MPAddVASAction",nil,true] spawn BIS_fnc_MP; if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3";}; }; }; }; }; Share this post Link to post Share on other sites
Beerkan 71 Posted September 6, 2014 (edited) Whoops, sloppy on my part. I tried this out, but I am still doing something wrong.Yes.It should be if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {_veh setVehicleVarName "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {_veh setVehicleVarName "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {_veh setVehicleVarName "MHQ3";}; Unfortunately first time around I assumed you had the correct syntax on the line and had just missplaced the }; However, I've corrected the syntax and added the missing _veh variable to your script. Edited September 6, 2014 by Beerkan Share this post Link to post Share on other sites
callmesarge 7 Posted September 7, 2014 Thanks Beerkan - the respawn script runs now, but I still cannot teleport to the mhq after it has respawned. Do you think it could be something wrong with the teleport code? _id = mypole addaction ["Teleport To MHQ1",{(_this select 1)setPos getPos MHQ1;(_this select 1) moveInCargo MHQ1; },nil,6,false,true,"","alive MHQ1&& {speed MHQ1< 1}"]; _id2 = mypole addaction ["Teleport To MHQ2",{(_this select 1)setPos getPos MHQ2;(_this select 1) moveInCargo MHQ2; },nil,6,false,true,"","alive MHQ2 && {speed MHQ2 < 1}"]; _id3 = mypole addaction ["Teleport To MHQ3",{(_this select 1)setPos getPos MHQ3;(_this select 1) moveInCargo MHQ3; },nil,6,false,true,"","alive MHQ3 && {speed MHQ3 < 1}"]; Share this post Link to post Share on other sites
CapBlackShot 11 Posted September 8, 2014 Hello, Beearkan! Me again! :p Could you imagine why isn't the script working properly with my UAVs? Actually, I have three UAVs in the map, but when they respawn I can't access the UAV terminal anymore. Any idea? Thanks! Share this post Link to post Share on other sites
iceman77 18 Posted September 9, 2014 Unfortunately I haven't been involved with Arma in any capacity for about a 9 months. I'm not sure why you're having trouble with UAVs and I don't even have A3 installed atm to do any troubleshooting. Sorry =/ Share this post Link to post Share on other sites
CapBlackShot 11 Posted September 9, 2014 Unfortunately I haven't been involved with Arma in any capacity for about a 9 months. I'm not sure why you're having trouble with UAVs and I don't even have A3 installed atm to do any troubleshooting. Sorry =/ No problem, sir. You did a great job on ArmA 3 forums! Thank you for that! I hope you get back someday! You are really important to us! :) Also, Beerkan is doing a great job here! I hope he can help me! :p Share this post Link to post Share on other sites
Beerkan 71 Posted September 12, 2014 .... Also, Beerkan is doing a great job here! I hope he can help me! :pDid you try replacing these lines if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3";}; with these lines? if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {missionNamespace setVariable ["MHQ1", _veh];publicVariable "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {missionNamespace setVariable ["MHQ2", _veh];publicVariable "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {missionNamespace setVariable ["MHQ3", _veh];publicVariable "MHQ3";}; Share this post Link to post Share on other sites
callmesarge 7 Posted September 13, 2014 Will try that when I get home tomorrow, thanks beerkan! Share this post Link to post Share on other sites
CapBlackShot 11 Posted September 13, 2014 (edited) Did you try replacing these lines if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {setVehicleVarName "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {setVehicleVarName "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {setVehicleVarName "MHQ3";}; with these lines? if (_veh iskindof "B_APC_Wheeled_01_cannon_F") then {missionNamespace setVariable ["MHQ1", _veh];publicVariable "MHQ1";}; if (_veh iskindof "B_APC_Tracked_01_rcws_F") then {missionNamespace setVariable ["MHQ2", _veh];publicVariable "MHQ2";}; if (_veh iskindof "O_Heli_Light_02_unarmed_F") then {missionNamespace setVariable ["MHQ3", _veh];publicVariable "MHQ3";}; Oh, I'm sorry! Were you talking to CallMeSarge or is it part of a file released by you? Because I don't have these lines on the original one. Thanks! Edited September 13, 2014 by CapBlackShot Share this post Link to post Share on other sites
Beerkan 71 Posted September 14, 2014 @CapBlackShot.. this is your answer for UAV's.. UAV-respawn @CallmeSarge Can you let us know if my suggestion worked? Share this post Link to post Share on other sites
CapBlackShot 11 Posted September 15, 2014 (edited) Wrong post. Testing some changes on UAV. Edited September 15, 2014 by CapBlackShot Share this post Link to post Share on other sites
callmesarge 7 Posted September 15, 2014 @CallmeSargeCan you let us know if my suggestion worked? Worked like a charm mate - I think I owe you a beercan or two! Don't spose you are anywhere near essex? Share this post Link to post Share on other sites
dum3d0 11 Posted September 28, 2014 (edited) Hi, I can't make it work, after destroyed or abandoned the vehicle respawn but I can't get in (like closed) and all the stuff I put in his init is gone and inside I have default stuff (some yellow FirstAid), strangely if destroyed, respawn still works so the _nul = [this, 0.1, 0.1, {}] execVM "scripts\vehrespawn.sqf"; part still remain in his init. in the vehicle init I got: clearMagazineCargoGlobal this; clearItemCargoGlobal this; clearWeaponCargoGlobal this; this addMagazineCargo ["SmokeShell", 10]; _nul = [this, 0.1, 0.1, {}] execVM "scripts\vehrespawn.sqf"; I tried also a function so Vehicle Init is: clearMagazineCargoGlobal this; clearItemCargoGlobal this; clearWeaponCargoGlobal this; this addMagazineCargo ["SmokeShell", 10]; _nul = [this, 0.1, 0.1, {TAG_FNC_QuadbikeInit}] execVM "scripts\vehrespawn.sqf"; and in vehInitFunctions.sqf I created: TAG_FNC_QuadbikeInit = { _veh = _this select 0; clearMagazineCargoGlobal _veh; clearItemCargoGlobal _veh; clearWeaponCargoGlobal _veh; _veh addMagazineCargo ["SmokeShell", 10]; }; Vehicle obviously is an empty NATO Quad (B_Quadbike_01_F) and before destroyed or abandoned I have only 10 SmokeShell inside. Path to .sqf files are correct, I tried it on editor preview. //EDIT after several hour Ok I found answer to several problem: 1) If you try to preview in mission editor at respawn vehicle is closed, if you try it on dedicated server (or listen I presume) at respawn you don't have this problem. 2) The error in the function was here _veh addMagazineCargo ["SmokeShell", 10]; You need addMagazineCargoGlobal so the right one is: _veh addMagazineCargoGlobal ["SmokeShell", 10]; Edited September 28, 2014 by DuM3D0 Ok I found the way to make it work Share this post Link to post Share on other sites
Smoerble 11 Posted October 13, 2014 I need you rhelp please: I integrated the script and it works fine, many thanks!!! I want to have a vehicle respawning, that can be used as a spawn. I created a unit: name: respawn_Zamak. Initialization: _nul = [this, 60, 5] execVM "vehrespawn.sqf"; I changed your script slightly: at top: _thisName = name _veh; Below I changed _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; to _veh = createVehicle [_vehtype, _pos, [], 0, "CAN_COLLIDE"]; _veh setName _thisName; In the init.sqf I use this to make the Zamak a spawn point. newRespawnPos = [west, "respawn_Zamak"] call BIS_fnc_addRespawnPosition; This works until the Zamak respawns. Then it's not a spawnpoint anymore. Anyone has an idea how to fix this please? Share this post Link to post Share on other sites
jshock 513 Posted October 13, 2014 Respawn EH, just have the addRespawnPosition function call execute on it's respawn. Share this post Link to post Share on other sites
iceman77 18 Posted October 13, 2014 @smoerble - Why not use one of the advanced versions? They were specifically made for (re)running code on the respawned vehicle. @Jshock - "Respawn EH, just have the addRespawnPosition function call execute on it's respawn. " << Think about that for just a second :) Share this post Link to post Share on other sites
iceman77 18 Posted October 21, 2014 Updated: - Re-wrote and consolidated the versions as 3 were too many. Now there's just Larrow's NSLVR & LVR. - LVR now has a new veh init structure. Users now (OPTIONALLY) simply create their small function files (registered in cfgFunctions this time) and have the vehicle call the function upon respawn to set it's init. Cheers. Share this post Link to post Share on other sites
kamaradski 10 Posted October 21, 2014 Looking through the code, i didnt see any function that keeps check of how many people are near the vehicle in a certain radius. before allowing it to be abandoned. I personally hate it, if me and my crew drive to a mission, park the car/truck out of sight, do our thing, and upon return the vehicle is gone ... (transport / medivac / supplies). I also do not want to task a teammember to stay with the vehicle and miss all the action, in a ambush or regular mission i need all hands on deck. I have such a function in the script i currently use in T&A, it's slightly heavy since it cycles through all playable units, but it works non the less :) (Probably a locally configured trigger attached to the vehicle would perform way better) _DistChck = 500; // Check if the vehicle is deserted. if (_deserted > 0) then { _nearPlayers = false; { if ((_x distance _unit) < _DistChck) exitWith { _nearPlayers = true; }; } forEach playableUnits; if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8) and !_nearPlayers) 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}; }; }; Another good thing would be an option to leave the wrecks behind permanently. This will not work for perpetual missions, but is great for shorter scenarios. Share this post Link to post Share on other sites
iceman77 18 Posted October 21, 2014 Cheers. Larrow wrote an advanced version (like almost a year ago) of LVR. It's in the original post. It has abandoned, destroyed, desertion radius, position reset and some more wonky features LOL. Share this post Link to post Share on other sites
kamaradski 10 Posted October 21, 2014 True that, but it is not very light anymore. Request permission to use your script in my mission, and add my own function in ? Share this post Link to post Share on other sites
iceman77 18 Posted October 21, 2014 (edited) Go for it. You're free to edit and even redistribute it. Let me know how the vehicle init works in MP. I may have to tweak it. Edited October 21, 2014 by Iceman77 Share this post Link to post Share on other sites
Guest Posted October 21, 2014 Release frontpaged on the Armaholic homepage. Light Vehicle Respawn Script v2014-10-21 ================================================ We have also "connected" these pages to your account on Armaholic. This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have. When you have any questions already feel free to PM or email me! Share this post Link to post Share on other sites