Synide 0 Posted June 11, 2007 similar to norrin's in that it spawns a server-side monitoring script thread for each respawnable vehicle but makes use of the in-build 'respawnVehicle' scripting command and just setPos's it back to it's original posistion. The use of the 'respawnVehicle' scripting command means you can take advantage of this commands in-built 'Number of respawns' mechanism. the script thread for a given vehicle will only live for the duration of the respawnCount for the unit. so if you have the respawnCount for a vehicle set to unlimited that vehicles server-side monitoring 'thread' will run indefinitely. Whereas if you had it set to '3' then the monitoring 'thread' would disapear after this number. The reasons I like this method of Vehicle Respawn. Â Â Â Â 1. It uses the in-built scripting command respawnVehicle. Â Â Â Â 2. You place your vehicle anywhere and just name it. Â Â Â Â 3. You specify the 'Vehicle' , 'RespawnDelay' and 'RespawnCount' for each respawnable vehicle in one spot in your script. It's easy to goto one place in the init script for the server and alter the 'respawn' settings for a given vehicle. just pull it apart to see how it works... vRespawn_v1c.Sara.pbo This is my personal comp. so it's not on all the time... Share this post Link to post Share on other sites
Synide 0 Posted June 12, 2007 i'll just paste the abridged version below... init.sqf... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*     Synide     11/6/2007     v1.0     Things to note... If you are there at mission launch from that point on your 'Context' will always be 'MP_CLIENT' and will stay as such even when you respawn. If you are an 'MP_CLIENT' then you 'disconnect' from a continuing mission and select a new playable character or the same playable character you will become a 'JIP_CLIENT'. If you join an inprogress mission you will be a 'JIP_CLIENT' from that point till the mission ends. */ //init.sqf debug=false; if (isServer) then {  if (isnull player) then {Context = "MP_SERVER";}else{Context = "SP_SERVER";}; }else{  if (isnull player) then {Context = "JIP_CLIENT";}else{Context = "MP_CLIENT";}; }; call compile preProcessFile "scripts\common\init.sqf"; call compile preProcessFile format["scripts\%1\init.sqf",Context]; processInitCommands; finishMissionInit; scripts\common\init.sqf... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*     Synide     11/6/2007     v1.0 */ //common\init.sqf enableteamswitch false; setTerrainGrid 50; // [Unit,Delay,NoOfRespawns,Unit,Delay,NoOfRespawns...] // Note. Delay is in mins, NoOfRespawns of -1 means unlimited. // hard coded the array 'cause its faster than a trigger array construction but less flexiable. aryRespawnableVehicles = [HMVM2a,.5,-1,M1A1a,1,2,AH6a,.75,2,AV8Ba,.5,3,UH60a,.2,-1,KA50a,2,2]; aryRespawnableVehicles = aryRespawnableVehicles + [MI17a,1,4,MI17b,3,0,AV8Bb,2,2,UAZa,.5,-1]; aryRespawnableVehicles = aryRespawnableVehicles + [T72a,2,-1,SHILKAa,1,0]; scripts\mp_server\init.sqf... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*     Synide     11/6/2007     v1.0 */ //mp_server\init.sqf vMonitor    = compile preprocessfile "scripts\mp_server\vMonitor.sqf"; aryVStartPos = []; if ((count aryRespawnableVehicles) > 0) then {   for "_i" from 0 to ((count aryRespawnableVehicles)-3) step 3 do   {    _j = aryRespawnableVehicles select _i;       // Vehicle    _k = aryRespawnableVehicles select (_i + 1);   // Delay    _l = aryRespawnableVehicles select (_i + 2);   // Count    aryVStartPos = aryVStartPos + [(format["%1",_j]), (getPos _j + [getDir _j])];    if (_l != -1) then {_j respawnVehicle [(_k * 60), _l];} else {_j respawnVehicle [(_k * 60)];};    call compile format["_h%1 = [_j,_l] spawn vMonitor;", _j]; //spawn a watching thread on the server for each vehicle   }; }; scripts\mp_server\vMonitor.sqf... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*     Synide     11/6/2007     v1.0 */ //mp_server\vMonitor.sqf _Vehicle = _this select 0; _RespawnMax = _this select 1; _SpawnPos = aryVStartPos select ((aryVStartPos find (format["%1", _Vehicle]))+ 1); _SpawnDir = _SpawnPos select 3; _SpawnPos = [_SpawnPos select 0, _SpawnPos select 1, _SpawnPos select 2]; _RespawnCount=0;_hasDied=false;_alive=false;_Condition=true; for [{},{_Condition},{true}] do {    // death related...    if ((!_hasDied) and (alive _Vehicle)) then {call compile format ["_Vehicle = %1;", vehicleVarName _Vehicle];};       if ((!alive _Vehicle) and (!_hasDied)) then {_hasDied = true;};       call compile format["_alive = alive %1;", vehicleVarName _Vehicle];       if (_hasDied  and _alive) then    {      deleteVehicle _Vehicle;      call compile format ["_Vehicle = %1;", vehicleVarName _Vehicle];      _RespawnCount = _RespawnCount + 1;      _Vehicle setDir _SpawnDir;      _Vehicle setPos _SpawnPos;      _Vehicle setvelocity [0,0,0];      _hasDied = false;    };    sleep 1;    if (_RespawnMax != -1) then {_Condition = _RespawnCount < _RespawnMax;}; }; scripts\sp_server\init.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*     Synide     11/6/2007     v1.0 */ //sp_server\init.sqf //everything in initialization on a dedicated server you should also //do in the context of a singleplayer server or 'host' server. call mp_server; //call mp_client; description.ext... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class header {  gameType="team";  minPlayers=1;  maxPlayers=6; }; respawn="base"; respawnDelay=10; disableAI=0; I won't detail the mission.sqm... waste of space. Make your own... it should have the following. 1. a 'respawn_west' marker for your playable units. 2. a 'respawn_vehicle_west' marker at some distant out of the way spot on the map. 3. west vehicles placed arbitrarily around with appropriate names in the editor. (you should alter the 'aryRespawnableVehicles' to reflect your unit names and desired respawn delay and respawn count for each unit) 4. do the same for the 'east' side. you should be good to go. Share this post Link to post Share on other sites
Synide 0 Posted June 21, 2007 lol, interesting i would have thought someone would have poked holes in this by now?! Share this post Link to post Share on other sites
SamuraiMushroom 0 Posted July 22, 2007 I haven't gotten this to work. From what I can tell, the vMonitor script isn't running, as if the array is empty. However I have yet to get a vehicle to respawn in any way shape or form. Share this post Link to post Share on other sites
BigRed 2 Posted July 22, 2007 I got 20$ says they move this to mission editing and scripting Share this post Link to post Share on other sites
Synide 0 Posted July 23, 2007 Did you try downloading the pbo? The computer isn't on all the time so if you can't then PM me your email and i'll send you the test mission. I use it pretty much all the time... flawlessly. Share this post Link to post Share on other sites