pazuzu 21 Posted October 1, 2019 On 9/27/2019 at 12:19 AM, pierremgi said: Yes, the script checks for marker(s) first, then "start" as string parameter. So if a marker is named 'start", this one will be used. What you can do is: - mark the initial position by a marker like "veh1Start" and specify this marker in your command line : 0 = [[veh1],["veh1Start"],10,true,false] spawn MGI_fnc_VehicleRespawn; - change my script (command line included) to read "startVeh" as string anytime you read "start". This way,(if you don't have any marker already named "startVeh", this string will operate and the true position at start will be used. NOTE: There are some remaining problems, respawning on a carrier, and when UAV has remaining waypoints, choosing the start position. I'll check that. Just realized I did what you suggested wrong. I changed the script line to: if (_position == 'startVeh' or (_x getVariable ['emptyVeh',false])) exitWith {_pos = getPos _veh}; "change my script (command line included) to read "startVeh" as string anytime you read "start". I'm a little confused about what you say here. Am I to change command line too? My command line now is like this: 0 = [[veh1],["veh1Start"],10,true,false] spawn MGI_fnc_VehicleRespawn; veh1Start is marker name placed at UAV position. Or should I be using startVeh? Thanks. Share this post Link to post Share on other sites
pierremgi 4906 Posted October 2, 2019 Formerly, in these scripts, "start" is used as a string different from any marker, saying you want to use the initial position for respawning. "death" is also a specific string for respawning where the vehicle was destroyed/crashed. If your mod/script uses "start" as marker name, not my bad, the vehicle will respawn at this marker just because my script checks for any marker before other possibilities. So, if you have a marker named "start" and you want to respawn at initial position, the simplest workaround is to modify the script for reading another string, no matter which one, but you must be consistent, so change "start" by "anyNameYouLike" everywhere in the script. The result will be the same. If you read the "notice", a simple "anyNameYouLike" as parameter will be efficient for any vehicle to be respawned on its initial place. "start" (or "anyNameYouLike") and "death" are generic. No need to refer at one vehicle. Read the explanation. Share this post Link to post Share on other sites
zagor64bz 1225 Posted October 2, 2019 Maybe I'm getting lost here... is the issue of the carrier deck height spawn resolved? Share this post Link to post Share on other sites
pierremgi 4906 Posted October 2, 2019 WIP. Lack of time. 1 Share this post Link to post Share on other sites
pazuzu 21 Posted October 2, 2019 Ahh, there's an issue with spawn height? I've gotten my UAV to spawn in original position on carrier deck but not at right height. I tested spawning on land and everything else seems to work fine like having same skin and loadout... Share this post Link to post Share on other sites
zagor64bz 1225 Posted October 3, 2019 21 hours ago, pazuzu said: Ahh, there's an issue with spawn height? I've gotten my UAV to spawn in original position on carrier deck but not at right height. I tested spawning on land and everything else seems to work fine like having same skin and loadout... Same here. I have a FLY mission out, and it's set up on the carrier...I had to use the vanilla module to be able to get the jets/choppers spawning on the deck. On the same mission, but based on a land airport, the script works flawlessly. Share this post Link to post Share on other sites
pazuzu 21 Posted October 4, 2019 On 10/3/2019 at 11:26 AM, zagor64bz said: Same here. I have a FLY mission out, and it's set up on the carrier...I had to use the vanilla module to be able to get the jets/choppers spawning on the deck. On the same mission, but based on a land airport, the script works flawlessly. Did you try using a marker for respawn on carrier? Share this post Link to post Share on other sites
pierremgi 4906 Posted October 4, 2019 Just now, pazuzu said: Did you try using a marker for respawn on carrier? Marker is a bad idea. I implemented that just in case you don't want to respawn at start or death positions. I'm about to fix this problem without extra workaround but I discover that ditching disabled helo (say a stationary Huron fired by a single Titan AA MPRL) don't fire the MEH "entityKilled" when the Huron sinks and becomes wreck. It's weird. Working around (one more time!) on a specific Arma behavior. Share this post Link to post Share on other sites
pazuzu 21 Posted October 4, 2019 Ok. Thanks for letting me know. Share this post Link to post Share on other sites
zagor64bz 1225 Posted October 5, 2019 15 hours ago, pazuzu said: Did you try using a marker for respawn on carrier? Nope... I use the "START" option since I need them to re-spawn at theyr "parking" spots. But as @pierremgi stated, we need to be patient.. he's working on it. Share this post Link to post Share on other sites
pierremgi 4906 Posted October 10, 2019 Corrected for spawning vehicles on carrier at sea. + some improvements like helo ditching and in flight edited aircraft (already flying at mission's start). All feedback welcome. Some difficulties for respawning at death position an aircraft colliding with the ground (no previous damage). The solution needs some extra tests. 1 Share this post Link to post Share on other sites
pazuzu 21 Posted October 10, 2019 Thank you, pierremgi. I tested it on a Sentinel I have on carrier. The Sentinel respawned on deck but did not have same loadout, skin or option to use dynamic loadout addaction. I used the 2nd script with this command line: 0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn; veh1 is a tank I have for defense at base and respawns perfectly with crew and same skin. veh2 is the Sentinel. startpos is the start position string I changed from "start" in 2 lines of the script: if (_position == 'startpos' or (_x getVariable ['emptyVeh',false])) exitWith {_pos = getPosASL _veh}; if (_position != "startpos" && !(_x getVariable ["emptyVeh",false])) then { Not sure how this command line is supposed to work: 0 = [vehicles,vehicles apply {"start"},10,true,false] spawn MGI_fnc_VehicleRespawn // here start position applies on each vehicle. I appreciate your hard work. Share this post Link to post Share on other sites
pierremgi 4906 Posted October 10, 2019 Thanks for your feedback. The skin and loadout problem should be solved now. That was due to some blowing "at once" vehicles and my new performance saving EH. Please Try it now. When you write: 0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn (I know you changed "start" for "startPos" everywhere, due to your scenario), that means veh1 will respawn on its start position, but veh2 will respawn by default on its death position. (unless you're writing ["startPos","startPos"]) So, 0 = [vehicles,vehicles apply {"start"},10,true,false] spawn MGI_fnc_VehicleRespawn just means that you apply to the array of vehicles, an array of "start" as parameter, with the same number of elements in array. You can even write something like: _arrayOfVeh = vehicles select {_x isKindOf "landVehicle"}+vehicles select {_x isKindOf "air"}; _arrayOfpos = (vehicles select {_x isKindOf "landVehicle"}) apply {"death"}+ (vehicles select {_x isKindOf "air"}) apply {"start"}; 0 = [_arrayOfVeh,_arrayOfPos,10,true,false] spawn MGI_fnc_VehicleRespawn if you want to respawn planes and helos on death positions and ground vehicles on start ones. Don't forget, spawned vehicles are not taken into account with this kind of line. You must do a loop or use side parameter for that (or use my advanced module, to be corrected soon). 1 Share this post Link to post Share on other sites
pazuzu 21 Posted October 10, 2019 Quote When you write: 0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn (I know you changed "start" for "startPos" everywhere, due to your scenario), that means veh1 will respawn on its start position, but veh2 will respawn by default on its death position. (unless you're writing ["startPos","startPos"]) So for every vehicle added I have to add "startpos" to the string line to get every vehicle to respawn at start position? I'll test it again and let you know how it goes. Thanks. 1 Share this post Link to post Share on other sites
pazuzu 21 Posted October 10, 2019 Ok, I tested again with this command line: 0 = [[veh1,veh2],["startpos","startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn; I tested in editor and on my server. When I blow stationary Sentinel it respawns with same skin and loadout but the dynamic loadout script does not work. I get option in action menu but loadout menu does not work (shows no selection). Also, when I scroll through action menu the highlighted part disappears as though it's selecting an invisible option...if that makes sense...) If I fly the Sentinal and crash it, it respawns in original position but is traveling fast and just crashes at other side of carrier and keeps doing that. I'm going to try to find out what dynamic loadout script xeno uses (it may be his own), I know it's not GOM but maybe that will help to figure that part out. Share this post Link to post Share on other sites
pierremgi 4906 Posted October 11, 2019 I can't reproduce that. Check for startPos eveywhere again. If sentinel takes velocity, that's because it's not touching ground (i.e. the deck). Check the positioning of your UAV by isTouchingGround command. (out of map cursorObject is always null, use cursorTarget or vehicle name). Normally, you can recover addAction on respawn because I scripted for that. I don't know (and I don't care) if it's compatible with other mods playing with menus. I'm scripting for Vanilla (+ vehicles mods like CUP or RHS), but in any case for ACE or exotic mods altering menus. I don't know if it's your case. It's just an info. I spent hours to test sentinel on carrier or ashore, with different pylons, so, except if you have a reproducible mission (or uploaded file), I can't help anymore. Share this post Link to post Share on other sites
pazuzu 21 Posted October 14, 2019 Well, I must be doing something wrong so I'll just keep working on it. Thanks for the help. 1 Share this post Link to post Share on other sites
mzgr 8 Posted March 26, 2020 Hello Mr. pierremgi, the reason why I came across your script is becouse i am looking for a way to keep RHS skins and loadout after respawn. Unfortuntaly for me, I know nothing of scripting and have very limited knowledge of mission making. Please keep that in mind :) I have two sides (BLUEFOR, OPFOR), each side has 1 APC and 2 cars. Total of 6 vehicles. Only the cars are meant to respawn and the APCs are not. I need these 4 cars to respwan on starting position, after 10 seconds only after they are completly destroyed. And it would be nice if the wreck is not deleted after respawn. I put your SECOND SCRIPT (instead of first one) for MGI_fnc_vehicleRespawn (now adding skin, appearance, loadout, pylons and turrets config, actions menu) in initServer.sqf and i saw that it works like a charm. However, since i need the script to work only on some vehicles and not all, I could use some advice on how to make it happen if you have the time and patience. Ty Share this post Link to post Share on other sites
pierremgi 4906 Posted March 27, 2020 16 hours ago, mzgr said: Hello Mr. pierremgi, the reason why I came across your script is becouse i am looking for a way to keep RHS skins and loadout after respawn. Unfortuntaly for me, I know nothing of scripting and have very limited knowledge of mission making. Please keep that in mind 🙂 I have two sides (BLUEFOR, OPFOR), each side has 1 APC and 2 cars. Total of 6 vehicles. Only the cars are meant to respawn and the APCs are not. I need these 4 cars to respwan on starting position, after 10 seconds only after they are completly destroyed. And it would be nice if the wreck is not deleted after respawn. I put your SECOND SCRIPT (instead of first one) for MGI_fnc_vehicleRespawn (now adding skin, appearance, loadout, pylons and turrets config, actions menu) in initServer.sqf and i saw that it works like a charm. However, since i need the script to work only on some vehicles and not all, I could use some advice on how to make it happen if you have the time and patience. Ty OK, I modified this code JUST FOR YOUR AIM. Any other scripter please refer to the original script (or module) Here below, the script is skimmed for specific parameters. You must replace the array [apc1,apc2,apc3] at the last line of script, by your array of existing vehicle names (recommended). All elements of the array must exist in the editor. Remember this code will respawn the designated vehicles on start position only, and will let the wreck burning after respawn. That's specific to your request. Spoiler MGI_fnc_getVehicleLoadout = compileFinal " _veh = param [0,objNull, [objNull]]; _veh setVariable ['MGIallCont',[]]; (_veh getVariable 'MGIallCont') pushBack [_veh,itemCargo _veh,magazinesAmmoCargo _veh,weaponsItemsCargo _veh,backpackCargo _veh]; {(_veh getVariable 'MGIallCont') pushBack [_x select 0,itemCargo (_x select 1),magazinesAmmoCargo (_x select 1),weaponsItemsCargo (_x select 1),[]]} forEach everyContainer _veh; "; MGI_fnc_setVehicleLoadout = compileFinal " params [['_newVeh',objNull,[objNull]], ['_oldVeh',objNull,[objNull]]]; if ( {_x isKindOf 'CAManBase'} count [_newVeh,_oldVeh] >0 or isnil {_oldVeh getVariable 'MGIallCont'}) exitWith {}; if (!isnil {_oldVeh actionParams 0}) then { private _flagArsenalDbl = false; if (!isnil {_oldVeh getVariable 'bis_addVirtualWeaponCargo_cargo'}) then {_newVeh setVariable ['bis_addvirtualweaponcargo_cargo', _oldVeh getVariable ['bis_addvirtualweaponcargo_cargo',''],true]}; for '_i' from 0 to (_oldVeh addAction ['','']) -1 do { if (!_flagArsenalDbl or !(['bis_fnc_arsenal',_oldVeh actionParams _i select 1] call bis_fnc_instring)) then { private _act = _oldVeh actionParams _i; {_act deleteAt 10;true} count [1,2]; [_newVeh,_act] remoteExec ['addaction',0,true]; if(['bis_fnc_arsenal',_oldVeh actionParams _i select 1] call bis_fnc_instring) then {_flagArsenalDbl = true}; }; }; }; if (typeOf _newVeh isEqualTo typeOf _oldVeh) then { private _oldTexture = getObjectTextures _oldVeh; if ( count _oldTexture > 0) then { for '_i' from 0 to count _oldTexture - 1 do { _oldTexture set [_i,[_i,_oldTexture select _i]] }; {_newVeh setObjectTextureGlobal _x } forEach _oldTexture; }; private _animList = animationNames _oldVeh; if (count _animList > 0) then { _ll = []; for '_i' from 0 to count _animList -1 do { _ll pushBack [_animList select _i,_oldVeh animationPhase (_animList select _i)]; {_newVeh animate _x} forEach _ll; }; }; if (_newVeh isKindOf 'air') then { private _pylons = _oldVeh getVariable ['vehiclePylons', getPylonMagazines _oldVeh]; private _pylonPaths = (configProperties [configFile >> 'CfgVehicles' >> typeOf _oldVeh >> 'Components' >> 'TransportPylonsComponent' >> 'Pylons', 'isClass _x']) apply {getArray (_x >> 'turret')}; { _newVeh removeWeaponGlobal getText (configFile >> 'CfgMagazines' >> _x >> 'pylonWeapon') } forEach getPylonMagazines _newVeh; { _newVeh setPylonLoadOut [_forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons; }; if (!isNil {_oldveh getVariable 'vehicleFuel'}) then {_newveh setfuel (_oldVeh getVariable 'vehicleFuel')}; private _oldTrt = _oldVeh getVariable ['vehicleTrts',magazinesAllTurrets _oldVeh]; {_newVeh removeMagazineTurret _x} forEach (magazinesAllTurrets _newVeh apply {[_x select 0,_x select 1]}); {_newVeh addMagazineTurret _x} forEach _oldTrt; }; if (!isnil {_oldVeh getVariable 'MGIallCont'} && {(_oldveh getVariable 'MGIallCont') isEqualType []}) then { { _x params ['_cont',['_it',[]],['_mag',[]],['_wp',[]],['_bpk',[]]]; if (_cont isEqualType '') then { _cont = everyContainer _newVeh select (_foreachindex -1) select 1; } else { _cont = _newVeh; }; clearItemCargoGlobal _cont; clearMagazineCargoGlobal _cont; clearWeaponCargoGlobal _cont; clearBackpackCargoGlobal _cont; {_cont addItemCargoGlobal [_x,1]} count _it; {_cont addMagazineAmmoCargo [_x#0,1,_x#1]} count _mag; {_cont addWeaponWithAttachmentsCargoGlobal [_x,1]} count _wp; {_cont addBackpackCargoGlobal [_x,1]} count _bpk; } forEach (_oldVeh getVariable ['MGIallCont',[]]); } "; fn_destroy = compileFinal " params [['_destroyed',objNull]]; _type = (_destroyed getVariable 'MGIrespVehDATA') select 0; _pos = (_destroyed getVariable 'MGIrespVehDATA') select 1; _side = (_destroyed getVariable 'MGIrespVehDATA') select 2; _fullOldCrew = (_destroyed getVariable 'MGIrespVehDATA') select 3; _varName = (_destroyed getVariable 'MGIrespVehDATA') select 4; _initDir = (_destroyed getVariable 'MGIrespVehDATA') select 5; _initTouch = (_destroyed getVariable 'MGIrespVehDATA') select 6; _autonomous = (getText (configFile >> 'cfgVehicles' >> typeOf _destroyed >> 'vehicleClass') == 'Autonomous'); _initCode = (_destroyed getVariable ['MGIcustomCode','']); _respawnName ='initial point'; _cfgVeh = configfile >> 'cfgvehicles' >> typeOf _destroyed; _displayName = gettext (_cfgVeh >> 'displayName'); _picture = (gettext (_cfgVeh >> 'picture')) call bis_fnc_textureVehicleIcon; _curr = currentWaypoint group _destroyed; _posType = 'static'; _oldSpeed = _destroyed getVariable ['initSpeed',0]; _dir = _initDir; _onGround = (isTouchingGround _destroyed && surfaceIsWater getpos _destroyed) or (ASLToATL _pos) #2 < 10; _respMode = ['FLY','CAN_COLLIDE'] select _onGround; _timer = diag_tickTime; waitUntil {isTouchingGround _destroyed or diag_tickTime > _timer + 10}; uiSleep MGIrespVehDelay; _destroyed hideObjectGlobal true; _newVeh = createVehicle [_type, [0,0,0], [], 0, _respMode]; _newVeh allowDamage false; uiSleep 0.01; if (count (_pos nearEntities [['landVehicle','air','CAManBase','ReammoBox_F'],(0 boundingBoxReal _newVeh) #2 /2]) > 0 && !surfaceIsWater _pos) then { _pos = [_pos,0,100,(0 boundingBoxReal _newVeh) #2,1,0,0,[],[_pos,_pos]] call BIS_fnc_findSafePos; _pos set [2,0.1]; }; _newVeh setPosASL _pos; _newVeh setDir _dir; _newVeh lock (locked _destroyed); if !(_varName isEqualTo '') then { [_newVeh,_varname] remoteExec ['setVehicleVarName',0,true]; missionNameSpace setVariable [_varName, _newVeh, true]; }; [_newVeh,_destroyed] call MGI_fnc_setVehicleLoadout; if (_respawnName == 'grid') then { _respawnName = format [localize 'str_a3_bis_fnc_respawnmenuposition_grid',mapgridposition (position _newVeh)]; } else { _curr = 1}; uisleep 0.1; _newVeh allowDamage true; if (count _fullOldCrew > 0) then { _grps = []; { _unit = _x select 0; _typeUnit = typeOf _unit; _ldout = _unit getVariable ['oldLdOut',getUnitLoadout typeOf _unit]; _grp = _unit getVariable ['oldGrp',createGroup side _newVeh]; _varNameUu = _unit getVariable ['oldVar','']; _grps pushBackUnique _grp; if (!alive _unit or !isTouchingGround _newVeh or _posType == 'static') then { _uu = _grp createUnit [_typeUnit,[0,0,0],[],0,'NONE']; _uu allowDamage false; _uu setUnitLoadout _ldout; if !(_varNameUu isEqualTo '') then { [_uu,_varnameUu] remoteExec ['setVehicleVarName',0,true]; missionNameSpace setVariable [_varNameUu, _uu, true]; }; switch toLower (_x select 1) do { case 'driver': {_uu assignAsDriver _newVeh; _uu moveInDriver _newVeh}; case 'commander': {_uu assignAsCommander _newVeh; _uu moveInCommander _newVeh}; case 'gunner': {_uu assignAsGunner _newVeh; _uu moveInGunner _newVeh}; case 'cargo': {_uu assignAsCargoIndex [_newVeh,(_x select 2)]; _uu moveInCargo [_newVeh,(_x select 2)]}; case 'turret': {_uu assignAsTurret [_newVeh,(_x select 3)]; _uu moveInturret [_newVeh,(_x select 3)]}; }; [_uu] joinSilent _grp; _uu allowDamage true; } else { _unit allowDamage false; switch toLower (_x select 1) do { case 'driver': {_unit assignAsDriver _newVeh; _unit moveInDriver _newVeh}; case 'commander': {_unit assignAsCommander _newVeh; _unit moveInCommander _newVeh}; case 'gunner': {_unit assignAsGunner _newVeh; _unit moveInGunner _newVeh}; case 'cargo': {_unit assignAsCargoIndex [_newVeh,(_x select 2)]; _unit moveInCargo [_newVeh,(_x select 2)]}; case 'turret': {_unit assignAsTurret [_newVeh,(_x select 3)]; _unit moveInturret [_newVeh,(_x select 3)]}; }; _unit allowDamage true; }; } forEach _fullOldCrew; { _grp = _x; if (count waypoints _grp >1 && (effectiveCommander _newVeh in units _grp)) then { _grp selectLeader (effectiveCommander _newVeh); [_grp,_curr,_newveh] spawn { params ['_grp','_curr','_newVeh']; waituntil {sleep 1; if (_newVeh isKindOf 'air') then [{unitReady _newVeh},{TRUE}]}; comment 'seems to be necessary for some kind of assets. please report any lack of waypoints'; _grp setCurrentWaypoint [_grp,_curr]; leader _grp doMove (waypointPosition [_grp,_curr]); }; }; } forEach _grps; } else { _sideNbr = getNumber (configfile >> 'CfgVehicles' >> typeOf _newVeh >> 'side'); _side = [EAST,WEST,INDEPENDENT,CIVILIAN,sideUnknown,sideEnemy,sideFriendly] select _sideNbr; }; if (_initCode != '') then { (compile _initCode) remoteExec ['call',0,true]; _newVeh setVariable ['MGIcustomCode',_initCode,true]; }; if (_autonomous) then { createVehicleCrew _newVeh; _grp = _destroyed getVariable ['oldUAVGrp',createGroup side (crew _newVeh select 0)]; {[_x] joinSilent _grp} forEach crew _newVeh; if (count waypoints _grp >1) then { _grp setCurrentWaypoint [_grp,_curr]; leader _grp doMove (waypointPosition [_grp,_curr]); }; }; if (_oldSpeed != 0) then { if (!_onGround or !_initTouch) then { _newVeh setVelocityModelSpace [0,_oldSpeed/3.6,0]; }; }; _newVeh setUnloadInCombat [true, false]; if (isnull driver _newVeh) then { if (!isTouchingGround _newveh && !(_newVeh isKindOf 'ship')) then { _newVeh allowDamage false; _grdPos = getPosATL _newVeh; _grdPos set [2,0.5]; _newVeh setPosATL _grdPos; _newveh setVelocityModelSpace [0,0,0]; uisleep 1; _newVeh allowDamage true; _newVeh engineOn false; _newVeh animateSource ['canopy_hide',0,true]; }; }; if (!isNull _newVeh) then { ['RespawnVehicle',[_displayName,_respawnName,_picture]] remoteExec ['BIS_fnc_showNotification',_side]; }; uisleep 0.1; if (_destroyed in MGIrespVeh) then { _idx = MGIrespVeh find _destroyed; MGIrespVeh set [_idx, _newVeh]; MGIrespVeh = MGIrespVeh - [objNull] }; _destroyed setVariable ['MGIrespVehDATA',nil]; _destroyed setVariable ['MGIrespVehOK',nil]; "; MGI_fnc_VehicleRespawn = { if (!isServer && hasInterface) exitWith {}; params [["_vehs",[],[[],objNull,WEST],[]],["_positions","death",["",[]],[]],["_delay",10,[0]],["_respOnDisabled",false,[true]],["_empty",true,[true]]]; private ["_pos","_positionArray"]; MGIrespVehDelay = _delay max 2; MGIrespOnDisabled = _respOnDisabled; MGIrespVeh = _vehs; systemChat str MGIrespVeh; private ["_idx"]; while {true} do { uisleep 1; { _x setVariable ["MGIrespVehOK",true]; _x addEventHandler ["handledamage", { params ["_veh","_hit","_dam"]; if (isNil {_veh getVariable "vehicleLoadout"}) then { _veh call MGI_fnc_getVehicleLoadout; _veh setVariable ["vehicleLoadout",TRUE]; }; _veh spawn { _veh = _this; _timer = diag_tickTime; if (isnil {_veh getVariable "respDamaged"}) then { _veh setVariable ["respDamaged",true]; waitUntil {uiSleep 0.5; diag_tickTime > _timer + 1}; _veh setVariable ["respDamaged",nil]; }; }; _dam }]; group _x deleteGroupWhenEmpty false; if (fullCrew _x isEqualTo []) then { _x setVariable ["emptyVeh",true] } else { _x setVariable ["emptyVeh",false] }; _idx = MGIrespVeh find _x; _pos = getPosASL _x; _x setVariable ["MGIrespVehDATA",[typeOf _x ,_pos, side _x,fullcrew _x select {alive (_x select 0) && !((_x select 0) in ([[player],playableUnits] select isMultiplayer))},vehicleVarName _x,getDir _x,isTouchingGround _x]]; _x spawn { _veh = _this; while {isnil {_veh getVariable "fn_destroyed" && !isNull _veh}} do { uisleep 5; if (!alive _veh && {count crew _veh >0}) then { uisleep 2; if (isnil {_veh getVariable "fn_destroyed"}) then { _veh spawn fn_destroy; _veh setVariable ["fn_destroyed",true]; }; }; }; }; _x setVariable ["vehicleTrts",magazinesAllTurrets _x]; _x setVariable ["vehicleFuel", fuel _x]; { (_x #0) setVariable ["oldGrp",group (_x #0)]; (_x #0) setVariable ["oldVar",vehicleVarName (_x #0)]; (_x #0) setVariable ["oldLdOut",getUnitLoadout [(_x #0),true]]; } forEach fullCrew _x; } foreach (MGIrespVeh select {isNil {_x getVariable "MGIrespVehOK"}}); }; }; addMissionEventHandler ["EntityKilled",{ params ["_destroyed"]; if (local _destroyed && !isNil {_destroyed getVariable "MGIrespVehOK"} && !(_destroyed isKindOf "CAManBase")) then { _destroyed spawn fn_destroy; _destroyed setVariable ["fn_destroyed",true]; }; }]; 0 = [[apc1,apc2,apc3],nil,10,false,false] spawn MGI_fnc_VehicleRespawn; Share this post Link to post Share on other sites
mzgr 8 Posted March 27, 2020 Man...I am speachless. I could've never expected such a quick reply. Same as the script before, this one works perfectly. Thank you very much and please, if there is a way to support your work, let me know. 1 Share this post Link to post Share on other sites
pierremgi 4906 Posted April 29, 2020 New version SP/MP. See front page. - Crates will respawn if declared in the array of vehicle/side only - empty vehicles will respawn if the specific parameter is set to true, even if the civilian side is selected for respawn. If you just need a bunch of empty vehicles to be respawned, let the param to false and add these vehicles in the first array. - any backpack, uniform,vest content in vehicle/crate should respawn correctly. 1 Share this post Link to post Share on other sites
Darkbelg 6 Posted July 21, 2020 I have used the script. I have found that there is still something wrong with the sentinel uav. When it respawns it respawns with just one ai instead of the required two. I have tried to use createVehicleCrew in the init field of the vehicle but this doesn't seem to work. Share this post Link to post Share on other sites
pierremgi 4906 Posted July 22, 2020 Should work now. Thank you for report. 1 Share this post Link to post Share on other sites
avibird 1 155 Posted August 12, 2020 Hey pierremgi had anyone reported issues with armor vehicles after respawn keeping the ability to move to it's waypoints. I mostly use jebus for my respawning needs but his script is now having issues with armor units having the ability to reach its waypoints! Share this post Link to post Share on other sites
pierremgi 4906 Posted August 12, 2020 46 minutes ago, avibird 1 said: Hey pierremgi had anyone reported issues with armor vehicles after respawn keeping the ability to move to it's waypoints. I mostly use jebus for my respawning needs but his script is now having issues with armor units having the ability to reach its waypoints! Are you speaking about my script? No. That works fine. I suggest you to use my module, more developed. 1 Share this post Link to post Share on other sites