bangabob 42 Posted August 15, 2014 (edited) Drag Dead Body Script By BangaBob DescriptionDoes what it says on the tin. Hide dead bodies by dragging them out of sight or loading them inside vehicles. Fully Dedicated MP compatibleInstructionsSimple Copy this code into your Init.sqfnull = allUnits execVM "H8_dragBody.sqf";Functions [uNIT1,UNIT2,UNIT3] spawn H8_addDrag; Add living units into the script. (Useful for units spawned mid-mission).Known Bugs- Other players cannot see body drag/Animation until it is dropped ? (Should be fixed in 1.2)- No action upon Respawn (fixed in v1.2)ChangeLog 17/08/14 v1.2 Release - Respawn Event Handler scrapped. - Animations called globally. - Players can load/unload bodies into vehicles. - Tested on Dedicated for JIP issues Download Script here v1.2 Or copy the code H8_dragBody.sqf /* DragBody script by BangaBob (H8erMaker) v1.2 Description Drag dead bodies out of sight to avoid detection. JIP/MP/SP/Dedicated compatible Instructions Add this line into the init.sqf. This will add a drag action to all editor placed units. null = allUnits execVM "H8_dragBody.sqf"; Functions [uNIT1,UNIT2,UNIT3] spawn H8_addDrag; Add living units into the script. (Useful for units spawned mid-mission).*/#define H8_DRAGTEXT "Drag Body" // AddAction text for drag body#define H8_DROPTEXT "Release Body" // AddAction text for dropping body#define H8_LOADTEXT "Load Body" // AddAction text for dropping body#define H8_UNLOTEXT "Unload Body" // AddAction text for dropping body H8_fnc_Action = {_dragCond = "vehicle _this != vehicle _target and isNull attachedTo _target and count attachedObjects _this == 0 and _target distance _this < 3"; { _x addaction [H8_DRAGTEXT,{call H8_DragAction},nil,6,false,false,"",_dragCond]; }forEach _this; }; H8_DragAction = { _unit = (_this select 0);// GLOBAL CODE _unitID = _unit getVariable "H8_increm"; [[_unit, vehicle player,_unitID],"H8_fnc_attach",true] call BIS_fnc_MP; _unit attachTo [player,[0,1,0]];// CLIENT SIDE player playAction "grabDrag"; player forceWalk true;_dropID= player addAction [H8_DROPTEXT,{call H8_dropAction},_unit,6];_hideID =player addAction [H8_LOADTEXT,{call H8_putIncar},_unit,6,false,false,"","_target distance _this < 8 and cursorTarget isKindOf ""LandVehicle"""]; player setVariable ["H8hideVeh",_hideID]; player setVariable ["H8dropact",_dropID]; }; H8_putIncar = { _hideID = (_this select 2); _dropID = player getVariable "H8dropact"; _unit = (_this select 3); _vehicle = cursorTarget;_loadedBody =_vehicle getVariable "H8loadedBody"; if (isNil "_loadedBody") then {// CLIENT CODE player playMove "amovpknlmstpsraswrfldnon"; player forceWalk false; player removeAction _hideID; player removeAction _dropID;// GLOBAL CODE _unitID = _unit getVariable "H8_increm"; 0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP; sleep 1; deTach _unit; _unit setPos [0,0,0]; _vehicle setVariable ["H8loadedBody",_unit,true]; [[_vehicle],"H8_carAction",true] call BIS_fnc_MP; }else{hint "Vehicle already has a body loaded"; }; }; H8_carAction = { _vehicle = (_this select 0); _vehicle addAction [H8_UNLOTEXT,{call H8_removeBody},nil,0,false,false,"","_this distance _target < 8"]; }; H8_carRemoveAction = { _vehicle = (_this select 0); _id = (_this select 1); _vehicle removeAction _id; }; H8_removeBody = { _vehicle = (_this select 0); _player = (_this select 1); _id = (_this select 2); [[_vehicle,_id],"H8_carRemoveAction",true] call BIS_fnc_MP; _unit = _vehicle getVariable "H8loadedBody"; _vehicle setVariable ["H8loadedBody",Nil]; _pos = _player modelToWorld [1,0,0]; _unit setPos _pos; _unit switchMove "AinjPpneMstpSnonWrflDb_release"; }; H8_dropAction = { _dropID = (_this select 2); _hideID = player getVariable "H8hideVeh"; _unit = (_this select 3);// GLOBAL CODE _unitID = _unit getVariable "H8_increm"; 0 = [[_unit, vehicle player,_unitID],"H8_fnc_detach",true] call BIS_fnc_MP; deTach _unit;// CLIENT SIDE player removeAction _hideID; player removeAction _dropID; player playMove "amovpknlmstpsraswrfldnon"; player forceWalk false; }; H8_fnc_attach = { _unit = (_this select 0); _player = (_this select 1); _unitID = (_this select 2); _id = format ["h8EF%1",_unitID]; 0 = [_id, "onEachFrame", "H8_fnc_moveBody",[_unit,_player]] call BIS_fnc_addStackedEventHandler; }; H8_fnc_detach = { _unit = (_this select 0); _player = (_this select 1); _unitID = (_this select 2); _id = format ["h8EF%1",_unitID]; 0 = [_id, "onEachFrame"] call BIS_fnc_removeStackedEventHandler; sleep 0.05; _relD = [_unit,_player] call BIS_fnc_dirTo; _unit switchMove "AinjPpneMstpSnonWrflDb_release"; _unit setDir _relD; }; H8_fnc_moveBody = { _unit = (_this select 0); _player = (_this select 1);// CREDIT TOO Das Attorney FOR CODE _pos = _player modelToWorld [0,1,0]; _unit setPos _pos; _unit setDir 180; _unit switchMove "AinjPpneMrunSnonWnonDb"; }; H8_addDrag = { { H8_increments = H8_increments + 1; _x setVariable ["H8_increm",H8_increments,true]; H8_dragUnitArray set [count H8_dragUnitArray, _x]; }forEach _this; [_this,"H8_fnc_Action",TRUE] call BIS_fnc_MP;publicVariable "H8_increments";publicVariable "H8_dragUnitArray"; };if (isServer) then {if (isNil ("H8_dragUnitArray")) then { H8_dragUnitArray = []; H8_increments = 0;}; { H8_increments = H8_increments + 1; _x setVariable ["H8_increm",H8_increments,true]; H8_dragUnitArray set [count H8_dragUnitArray, _x]; }forEach _this;publicVariable "H8_increments"; publicVariable "H8_dragUnitArray"; };if (!isServer && (player != player)) then { waitUntil {player == player}; waitUntil {time > 15};}; if (!isDedicated) then { 0 = H8_dragUnitArray spawn H8_fnc_Action; };[/Php][/b][/center] Edited August 17, 2014 by BangaBob 3 Share this post Link to post Share on other sites
das attorney 858 Posted August 15, 2014 Nice. So that code worked okay for you then? Share this post Link to post Share on other sites
bangabob 42 Posted August 15, 2014 Nice. So that code worked okay for you then? Yeah it did the trick. Thanks Share this post Link to post Share on other sites
TheCodeMC 10 Posted August 15, 2014 Could the concept of this script be remade into an escort for someone that is handcuffed? So far I have got that there is an scroll wheel option on the AI That says Handcuff and they play the animation GUARD. Could you make an option once handcuffed that says Escort and it works in the same way as Dragging dead body's? and then an unescort which will let go of the guy and Leave him standing still in the GUARD Animation? I think this would be a cool idea also things like putting Handcuffed AI into vehicles and a way to release them. I guess this is quite complicated and Im a noob at scripting but Ive got this basic script so far that allows you to Handcuff someone: [badguy1, "GUARD", "ASIS"] call BIS_fnc_ambientanim; Thanks Share this post Link to post Share on other sites
zando912 10 Posted August 15, 2014 Nice thanks for making this :) Share this post Link to post Share on other sites
katipo66 94 Posted August 15, 2014 Wicked Bangabob! Appreciate this, it will add a lot of depth for infiltration style mission creation! Share this post Link to post Share on other sites
Fr3eMan 16 Posted August 15, 2014 Thanks Bangabob! :D Share this post Link to post Share on other sites
Guest Posted August 15, 2014 Release frontpaged on the Armaholic homepage. Drag Dead Body Script v1.0 ================================================ 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
Longboat 10 Posted August 15, 2014 Great job... just one bug i get when i release body on slope/hill he fly's up in the air and then sometimes after i move away i die. Share this post Link to post Share on other sites
Jigsor 176 Posted August 15, 2014 This is great Bangabob, yet another very useful script by you. Will try this in MP later tonight. I just tried this on spawned AI through eos and debug console but I get Error in expression < [uNITtest] spawn H8_addUnits;> Error position: <H8_addUnits;> Error Undefined variable in expression: h8_addunits I cannot find the function h8_addunits. Am I missing something? Thank you for all the great scripts BTW. Share this post Link to post Share on other sites
badlucky1776 3 Posted August 16, 2014 Is it possible to make this an addon? Share this post Link to post Share on other sites
bangabob 42 Posted August 16, 2014 This is great Bangabob, yet another very useful script by you. Will try this in MP later tonight. I just tried this on spawned AI through eos and debug console but I get Error in expression < [uNITtest] spawn H8_addUnits;> Error position: <H8_addUnits;> Error Undefined variable in expression: h8_addunits I cannot find the function h8_addunits. Am I missing something? Thank you for all the great scripts BTW. Thanks a lot. I have done some initial revisions based on my feedback. The function to addunits to the script is renamed "H8_addDrag". (So it will work properly now) Bug : (JIP units do not see the moved body in its new position) NOW RESOLVED Bug : (Other MP units do not see the drag animation) UNKNOWN Please download this version or copy the code and let me know how it goes :) ---------- Post added at 01:11 ---------- Previous post was at 01:10 ---------- Is it possible to make this an addon? I have no experience with add-on creation. But this is very simple to install into any mission anyway. Share this post Link to post Share on other sites
badlucky1776 3 Posted August 16, 2014 There are several scripts I always use but they get a little cumbersome. Im starting to prefer these things as "always ons." Share this post Link to post Share on other sites
Jigsor 176 Posted August 16, 2014 Thanks Bangabob, Ok I can drag AI now, but when I release they stay attached to me on hosted server with no other players. "Bug : (Other MP units do not see the drag animation) UNKNOWN" Don't know if this is related to this bug, but to be safe maybe execute animation on all machines if possible? [ [ _pilot, "AmovPercMstpSsurWnonDnon" ], "switchMoveEverywhere" ] call BIS_fnc_MP;// animation [ [ _pilot, "" ], "switchMoveEverywhere" ] call BIS_fnc_MP;// revert to default //function switchMoveEverywhere = compileFinal " _this select 0 switchMove (_this select 1); "; Share this post Link to post Share on other sites
bangabob 42 Posted August 16, 2014 Thanks Bangabob,Ok I can drag AI now, but when I release they stay attached to me on hosted server with no other players. "Bug : (Other MP units do not see the drag animation) UNKNOWN" Don't know if this is related to this bug, but to be safe maybe execute animation on all machines if possible? [ [ _pilot, "AmovPercMstpSsurWnonDnon" ], "switchMoveEverywhere" ] call BIS_fnc_MP;// animation [ [ _pilot, "" ], "switchMoveEverywhere" ] call BIS_fnc_MP;// revert to default //function switchMoveEverywhere = compileFinal " _this select 0 switchMove (_this select 1); "; Is this on a local server or a dedicated server? I have only tested on dedicated servers. Share this post Link to post Share on other sites
Jigsor 176 Posted August 16, 2014 Local server, I have not tested on dedi yet. Share this post Link to post Share on other sites
das attorney 858 Posted August 16, 2014 Yeah it did the trick. Thanks NP man. Glad you got some mileage out of it. nice work btw :) Share this post Link to post Share on other sites
Guest Posted August 16, 2014 Thanks for informing us about the updated version :cool: New version frontpaged on the Armaholic homepage. Drag Dead Body Script v1.1 ================================================ 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
Longboat 10 Posted August 16, 2014 Great job... just one bug i get when i release body on slope/hill he fly's up in the air and then sometimes after i move away i die. Clip to go with it Share this post Link to post Share on other sites
bangabob 42 Posted August 16, 2014 Clip to go with it Lol. Ok let me look into this. Probably a simple fix can be achieved using the enableSimulation command Share this post Link to post Share on other sites
Jigsor 176 Posted August 16, 2014 On dedicated I have an error client side after respawn. Error in expression < player addAction ["Release Body" ,{call H8_d> Error position: <addAction ["Release Body" ,{call H8_d> Error Type Any, expected String ---------- Post added at 05:19 PM ---------- Previous post was at 03:27 PM ---------- Pm sent. Share this post Link to post Share on other sites
bangabob 42 Posted August 17, 2014 v1.2 Release Code reworked for efficiency and reliability. I have added a new feature to load and unload bodies from vehicles. - Respawn Event Handler scrapped. - Animations called globally. - Players can load/unload bodies into vehicles. (BETA) Share this post Link to post Share on other sites
Guest Posted August 17, 2014 Thanks for informing us about the updated version again :cool: New version frontpaged on the Armaholic homepage. Drag Dead Body Script v1.2 ================================================ 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
Jigsor 176 Posted August 17, 2014 I've lost drag action after respawn in V1.2 on local hosted server Bangabob. Share this post Link to post Share on other sites
bangabob 42 Posted August 18, 2014 I've lost drag action after respawn in V1.2 on local hosted server Bangabob. Thats very strange since no actions are on the player. I tested it in dedicated too. Maybe it's some crazy locality issue when the player is also a server. Anyway! Sit tight. I had an epiphany and i think i can make this script much more flexible and 'light'. Share this post Link to post Share on other sites