Doolittle 0 Posted February 13, 2003 Greetings. Â Here is a way to make it so that when you die you lay there as a body and if a teammate comes up to your body then you "respawn" at that spot with your old weapons. Â This is great for co-op. description.ext </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">respawn = 3 respawndelay = 20 <span id='postcolor'> Make a trigger that runs repeatedly. Â Its condition should be "not alive player" and it's OnActivation should be [] exec "respawn.sqs". Â You will also need to put a Respawn_West marker on the map somewhere far away, like on a small island. respawn.sqs </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;by Doolittle enableRadio false _body = player _pos = getPos _body _magazines = magazines player _weapons = weapons player _camera = "CAMERA" camCreate _pos _camera cameraEffect ["Internal", "BACK"] cutText ["", "BLACK IN"] _camera camSetTarget _body _camera camSetRelPos [0.20, 0.39, 1.86] _camera camSetFov 0.143 _camera camCommit 0 @camCommitted _camera _camera camSetRelPos [2.71, 19.55, 12.94] _camera camSetFov 0.7 _camera camCommit 5 @camCommitted _camera cutText ["You are ""almost dead"" and waiting to be revived", "PLAIN DOWN"] _pos = getPos _body _pos = [_pos select 0, _pos select 1, 0] _dir = getDir _body @_body != player and alive player deleteVehicle _body _body = "Body" createVehicle _pos _body setDir _dir #nearest ~1 _soldier = nearestObject [_body, "SoldierWB"] ? isNull _soldier : goto "nearest" ? not alive _soldier : goto "nearest" ? _soldier distance _body > 5 : goto "nearest" ~1 deleteVehicle _body "player removeMagazine _x" forEach magazines player "player removeWeapon _x" forEach weapons player "player addMagazine _x" forEach _magazines "player addWeapon _x" forEach _weapons player selectWeapon primaryWeapon player player switchMove "LyingToCombat" player setPos _pos player setDir _dir player setCaptive true _camera camSetTarget player _camera camSetRelPos [10.49, 0.61, 3.48] _camera camSetFov 0.7 _camera camCommit 5 @camCommitted _camera _camera camSetRelPos [-0.82, -3.12, 3.38] _camera camSetFov 0.044 _camera camCommit 3.5 @camCommitted _camera player switchCamera "INTERNAL" player cameraEffect ["Terminate", "BACK"] camDestroy _camera enableRadio true player setCaptive false <span id='postcolor'> What this does is when you die it goes into cut scene mode. Â Meanwhile your dude is spawning on some island somewhere. Â When a SoldierWB is near your fake dead body, it transports your player and cuts out of cut scene mode. Â Make sure every player is SoldierWB. A mission with this in it can be found here as co14do_fourshilkas.zip. If you use this script for your missions please mention "Revive Respawn Script by Doolittle". Â I would really appreciate that. Â Thanks, as I myself stink/hate making missions but love to code script. Doolittle Share this post Link to post Share on other sites
Ruskiesrule 0 Posted February 13, 2003 can the AI use it by any chance? Oh, and good work, just like on Return to Castle Wolfenstein. Any ideas on making a player assigned as a medic? Share this post Link to post Share on other sites
Doolittle 0 Posted March 2, 2003 I rewrote the script. I am trying to do client/server model. This allows the AI to be "revived" too now. respawn.sqs </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;by Doolittle _string = _this select 0 _body = call format ["%1", _string] _string setMarkerPos getPos _body ?not local _body : exit ?_body == player : [] exec "cam.sqs" #notalive ~1 _obj = call format ["%1", _string] ?not alive _obj : goto "notalive" "_obj removeMagazine _x" forEach magazines _obj "_obj removeWeapon _x" forEach weapons _obj "_obj addMagazine _x" forEach magazines _body "_obj addWeapon _x" forEach weapons _body _obj selectWeapon primaryWeapon _obj _pos = getPos _body _pos = [_pos select 0, _pos select 1, 0] _dir = getDir _body _dir = _dir - 90 deleteVehicle _body _body = "Body" createVehicle _pos _body setDir _dir _ai = objNull #nearest ~1 _soldier = nearestObject [_body, soldierType] ?isNull _soldier : goto "nearest" ?not alive _soldier : goto "nearest" ?_ai != _soldier : _ai = _soldier; _ai doMove _pos ?_soldier distance _body > 5 : goto "nearest" ~1 deleteVehicle _body _obj = call format ["%1", _string] ?not alive _obj : exit _soldier doWatch _obj _soldier playMove "MedicToCombat" _obj switchMove "LyingToCombat" _obj setPos _pos _obj setDir _dir _obj setCaptive true ~5 ~3.5 _obj setCaptive false <span id='postcolor'> cam.sqs </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;by Doolittle enableRadio false _camera = "CAMERA" camCreate getPos player _camera cameraEffect ["Internal", "BACK"] cutText ["", "BLACK IN"] _body = player _camera camSetTarget _body _camera camSetRelPos [0.20, 0.39, 1.86] _camera camSetFov 0.143 _camera camCommit 0 @camCommitted _camera _camera camSetRelPos [2.71, 19.55, 12.94] _camera camSetFov 0.7 _camera camCommit 5 @camCommitted _camera cutText ["You are ""almost dead"" and waiting to be revived", "PLAIN DOWN"] @alive player ~1 _camera camCommit 0 _camera camCommand "manual on" @camCommitted _camera #list ~1 ?not (player in list playeralive) : goto "list" enableRadio true _pos = getPos player _pos = [_pos select 0, _pos select 1, 1] _camera camSetTarget _pos _camera camSetRelPos [10.49, 0.61, 3.48] _camera camSetFov 0.7 _camera camCommit 5 _camera camCommand "manual off" @camCommitted _camera _camera camSetRelPos [-0.82, -3.12, 3.38] _camera camSetFov 0.044 _camera camCommit 3.5 @camCommitted _camera player switchCamera "INTERNAL" player cameraEffect ["Terminate", "BACK"] camDestroy _camera <span id='postcolor'> I wanted to seperate all client side effects into it's own file and then have it "react" to whatever the respawn.sqs file was doing. Again, there is a new version of my example mission up called co12do_fourshilkas that implements this code. I also have markers being placed where someone dies so it is easy to find their body to revive them AND when you are dead you can fly around like a seagull while you wait to be revived. The AI can be revived AND it revives other people. It is cool seeing the AI run over to you and save you and also run to and save eachother. Doolittle Share this post Link to post Share on other sites
BKF.1 0 Posted March 18, 2006 Hello, I'm looking for download link to get your respawn script;) Links above are broken Share this post Link to post Share on other sites
Garcia 0 Posted March 18, 2006 Someone else has already done this Share this post Link to post Share on other sites
hardrock 1 Posted March 18, 2006 Yep, look out for the Mapfact Respawn, which does exactly that and is out there without all the errors that you probably will come up to yet. Forum Topic: Mapfact Respawn 2.0 Version 3.0 is to come soon. Share this post Link to post Share on other sites