nouty 10 Posted June 27, 2013 I was thinking of allowing any player to respawn as a civilian after they die, independent of their original side or faction. Is it possible to somehow respawn the player as civilian, with all the gear removed? Any help would be appreciated. :) Share this post Link to post Share on other sites
Yolo Joe 11 Posted June 30, 2013 This would be awesome in one of my missions too! Someone must have a answer to this? Share this post Link to post Share on other sites
nimrod_z 8 Posted June 30, 2013 (edited) feel free to use and modify as needed. just execute the script whenever you want a unit to change. /* Random player model at start and on respawn ====================================================== By Nimrod_Z must name playable units on map (in editor). if not named it will show error in rpt file because the script uses name and transfers it to newly created unit. that way, if you still have to refer to that name for whatever reason, you can. example: if (pl1 distance trashcan1 < 2) then {whatever code here}; In init sqf: model = compile preprocessFileLineNumbers "start_model.sqf"; pl_respawn = player addMPEventHandler ["MPRespawn", {call model}]; Execute with: call model; */ waitUntil {!isNull player}; waitUntil { player == player }; //keep from moving player enableSimulation false; // blackout cutText ["", "BLACK FADED", 999]; // array of possible civs to spawn as _clothes = ["RU_Assistant","RU_Citizen3","RU_Rocker1","RU_Woodlander2","RU_Rocker3","RU_Citizen2","Haris_Press_EP1","RU_Rocker4","RU_Woodlander1","RU_Citizen1","RU_Woodlander2","RU_Citizen4","RU_Woodlander3","RU_Rocker2","RU_Woodlander4","RU_Worker1","RU_Worker2","RU_Worker3"]; // setup handles _unit = player; _VarName = (vehicleVarName _unit); _posunit = getPos _unit; _newunit = _clothes select floor(random(count _clothes)); // teleport the old unit to [0,0,0] _unit setPos [0,0,0]; // Create the new unit _civilianCenter = createCenter civilian; _group = createGroup civilian; _model = _group createUnit [_newunit, _posunit, [], 0, "NONE"]; // remove all weapons, backpacks and items removeAllWeapons _model; removeBackpack _model; removeAllItems _model; //Make New Unit Playable addSwitchableUnit _model; setPlayable _model; selectPlayer _model; [_model] joinSilent grpNull; // log to RPT file what type of unit player spawned as diag_log format ["Character Model: %1", _newunit]; //Clear and delete old Unit removeAllWeapons _unit; {_unit removeMagazine _x;} forEach magazines _unit; deleteVehicle _unit; player disableConversation true; // Set name of unit _model SetVehicleVarName _VarName; _model call Compile Format ["%1= player ; PublicVariable ""%1""",_VarName]; // add respawn eventhandler to new unit _pl_respawn = player addMPEventHandler ["MPRespawn", {call model}]; // Allow player to move again player enableSimulation true; // make sure AI doesnt shoot at player setcaptive true; // Black in when spawned and greet player cutText [" ","BLACK IN",3]; Edited July 5, 2013 by Nimrod_Z originaly put script in spoiler to save spave but it looks ungly in there. :) sorry Share this post Link to post Share on other sites
nouty 10 Posted July 3, 2013 Thanks for the reply. I'll test it when I have time and try to figure it out. Share this post Link to post Share on other sites