Jump to content
Repentz

[Tutorial] Realistic Tazer

Recommended Posts

This script changes how tazing players works, instead of applying a tazing animation, it will use a ragdoll animation to simulate losing control of your body.

Now this ragdoll will only last 5 seconds, so i have added the effect of applying full fatigue, and damaging the player to 60% health, to force limping.

 

Step one: open up fn_tazed, replace all with this:

#include "..\..\script_macros.hpp"
/*
	File: fn_tazed.sqf
	Author: Bryan "Tonic" Boardwine
	Editor: Repentz to improve the function

	Description:
	Starts the tazed animation and broadcasts out what it needs to.
*/
private["_unit","_shooter","_curWep","_curMags","_attach"];
_unit = param [0,Objnull,[Objnull]];
_shooter = param [1,Objnull,[Objnull]];
if(isNull _unit OR isNull _shooter) exitWith {player allowDamage true; life_istazed = false;};
if(player getVariable["restrained",false]) exitWith {};
_time = time;
if(_shooter isKindOf "Man" && alive player) then {
	if(!life_istazed) then {
		life_istazed = true;
		"DynamicBlur" ppEffectEnable true;
		"DynamicBlur" ppEffectAdjust [20];
		"DynamicBlur" ppEffectCommit 1;
		player allowDamage false;
		if(isNull objectParent player) then {
			for [{_x=1},{_x<=10},{_x=_x+1}] do { call SOCK_fnc_tazeRagdoll; sleep 0.1; if(animationState player == "unconscious") exitWith{}};
		};
		//[_unit] remoteExecCall ["life_fnc_tazeSound",RCLIENT];
		[0,"STR_NOTF_Tazed",true,[profileName, _shooter getVariable["realname",name _shooter]]] remoteExecCall ["life_client_fnc_broadcast",-2];
		disableUserInput true;
		player setDamage 0;
		waitUntil{animationState player != "unconscious"};
		_anim = if(isNull objectParent player) then {"Incapacitated"} else {"kia_driver_mid01"};
		[player,_anim] remoteExec ["life_client_fnc_animSync",0];
		waitUntil{time - _time >= 15};
		player allowDamage true;
		if(!(player getVariable["Escorting",false])) then {
			detach player;
		};
		"DynamicBlur" ppEffectEnable false;
		life_istazed = false;
		disableUserInput false;
		player playMoveNow "amovppnemstpsraswrfldnon";
    player setFatigue 1; //no running for you
    player setdamage 0.6; //especially no running for you
	};
} else {
	_unit allowDamage true;
	life_iztazed = false;
};

 

Next, create a new file called fn_tazeRagdoll.sqf, place it in core -> session

Put the following into it:

if (!isNull objectParent player) exitWith {};
private "_tazered";
_tazered = "Land_Can_V3_F" createVehicleLocal [0,0,0];
_tazered setMass 1e10;
_tazered attachTo [player, [0,0,0], "Spine3"];
_tazered setVelocity [0,0,6];
detach _tazered;
0 = _tazered spawn {
	deleteVehicle _this;
};

Call this function in functions.h

under file = "Core\session"; place:

class tazeRagdoll {};

 

Tell me how it works.

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, works fine. But you might want to update your tutorial, as you need to change fn_ tazeRagdoll.sqf to fn_forceRagdoll.sqf and need to change it in the Functions.H

Share this post


Link to post
Share on other sites
10 hours ago, Tarkhgar said:

yes it's work for me i'm in altis life 5.0

Altis Life 5.0 isn't out yet.

You just grabbed the github when 5.0 was being made, so I wouldn't consider it 5.0

Share this post


Link to post
Share on other sites
10 hours ago, Rez said:

Nvm, it doesn't do the animation it just sets their screen black and spins them

haha are you sure you followed it correctly

Share this post


Link to post
Share on other sites
1 minute ago, Rez said:

yep

I'll take a look at mine tonight and let you know, here is my original tazeRagdoll though if it helps?

 

if (!isNull objectParent player) exitWith {};
private "_rag";
_rag = "Land_Can_V3_F" createVehicleLocal [0,0,0];
_rag setMass 1e10;
_rag attachTo [player, [0,0,0], "Spine3"];
_rag setVelocity [0,0,6];
detach _rag;
0 = _rag spawn {
	deleteVehicle _this;
};

 

Share this post


Link to post
Share on other sites

Hey real quick, I wanna add the tasers from A3L into my server, and when I add it to handledamage it doesn't work, and there is nothing in the logs for it

Share this post


Link to post
Share on other sites
1 minute ago, Rez said:

Hey real quick, I wanna add the tasers from A3L into my server, and when I add it to handledamage it doesn't work, and there is nothing in the logs for it

 

Here

//Handle the tazer first (Top-Priority).
if(!isNull _source) then {
	if(_source != _unit) then {
		_curWep = currentWeapon _source;
		if(_projectile in ["26_taser","B_556x45_dual"] && _curWep in ["Taser_26","arifle_SDAR_F"]) then {
			if(side _source == west && playerSide != west) then {
				private["_distance","_isVehicle","_isQuad"];
				_distance = if(_projectile == "B_556x45_dual") then {100} else {35};
				_isVehicle = if(vehicle player != player) then {true} else {false};
				_isQuad = if(_isVehicle) then {if(typeOf (vehicle player) == "B_Quadbike_01_F") then {true} else {false}} else {false};
				
				_damage = false;
				if(_unit distance _source < _distance) then {
					if(!life_istazed && !(_unit GVAR ["restrained",false])) then {
						if(_isVehicle && _isQuad) then {
							player action ["Eject",vehicle player];
							[_unit,_source] spawn life_fnc_tazed;
						} else {
							[_unit,_source] spawn life_fnc_tazed;
						};
					};
				};
			};
			
			//Temp fix for super tasers on cops.
			if(playerSide == west && side _source == west) then {
				_damage = false;
			};
		};
	};
};

 

Share this post


Link to post
Share on other sites
2 hours ago, Repentz said:

 

Here

//Handle the tazer first (Top-Priority).
if(!isNull _source) then {
	if(_source != _unit) then {
		_curWep = currentWeapon _source;
		if(_projectile in ["26_taser","B_556x45_dual"] && _curWep in ["Taser_26","arifle_SDAR_F"]) then {
			if(side _source == west && playerSide != west) then {
				private["_distance","_isVehicle","_isQuad"];
				_distance = if(_projectile == "B_556x45_dual") then {100} else {35};
				_isVehicle = if(vehicle player != player) then {true} else {false};
				_isQuad = if(_isVehicle) then {if(typeOf (vehicle player) == "B_Quadbike_01_F") then {true} else {false}} else {false};
				
				_damage = false;
				if(_unit distance _source < _distance) then {
					if(!life_istazed && !(_unit GVAR ["restrained",false])) then {
						if(_isVehicle && _isQuad) then {
							player action ["Eject",vehicle player];
							[_unit,_source] spawn life_fnc_tazed;
						} else {
							[_unit,_source] spawn life_fnc_tazed;
						};
					};
				};
			};
			
			//Temp fix for super tasers on cops.
			if(playerSide == west && side _source == west) then {
				_damage = false;
			};
		};
	};
};

 

didnt work

Share this post


Link to post
Share on other sites
21 minutes ago, Repentz said:

You need the bullet classname (not magazine) and weapon classname, mine works fine

Having issues with the script too, it'll work like once or twice then it wont work

Share this post


Link to post
Share on other sites
On 12/11/2016 at 5:25 AM, Repentz said:

This script changes how tazing players works, instead of applying a tazing animation, it will use a ragdoll animation to simulate losing control of your body.

Now this ragdoll will only last 5 seconds, so i have added the effect of applying full fatigue, and damaging the player to 60% health, to force limping.

 

Step one: open up fn_tazed, replace all with this:

#include "..\..\script_macros.hpp"
/*
	File: fn_tazed.sqf
	Author: Bryan "Tonic" Boardwine
	Editor: Repentz to improve the function

	Description:
	Starts the tazed animation and broadcasts out what it needs to.
*/
private["_unit","_shooter","_curWep","_curMags","_attach"];
_unit = param [0,Objnull,[Objnull]];
_shooter = param [1,Objnull,[Objnull]];
if(isNull _unit OR isNull _shooter) exitWith {player allowDamage true; life_istazed = false;};
if(player getVariable["restrained",false]) exitWith {};
_time = time;
if(_shooter isKindOf "Man" && alive player) then {
	if(!life_istazed) then {
		life_istazed = true;
		"DynamicBlur" ppEffectEnable true;
		"DynamicBlur" ppEffectAdjust [20];
		"DynamicBlur" ppEffectCommit 1;
		player allowDamage false;
		if(isNull objectParent player) then {
			for [{_x=1},{_x<=10},{_x=_x+1}] do { call SOCK_fnc_tazeRagdoll; sleep 0.1; if(animationState player == "unconscious") exitWith{}};
		};
		//[_unit] remoteExecCall ["life_fnc_tazeSound",RCLIENT];
		[0,"STR_NOTF_Tazed",true,[profileName, _shooter getVariable["realname",name _shooter]]] remoteExecCall ["life_client_fnc_broadcast",-2];
		disableUserInput true;
		player setDamage 0;
		waitUntil{animationState player != "unconscious"};
		_anim = if(isNull objectParent player) then {"Incapacitated"} else {"kia_driver_mid01"};
		[player,_anim] remoteExec ["life_client_fnc_animSync",0];
		waitUntil{time - _time >= 15};
		player allowDamage true;
		if(!(player getVariable["Escorting",false])) then {
			detach player;
		};
		"DynamicBlur" ppEffectEnable false;
		life_istazed = false;
		disableUserInput false;
		player playMoveNow "amovppnemstpsraswrfldnon";
    player setFatigue 1; //no running for you
    player setdamage 0.6; //especially no running for you
	};
} else {
	_unit allowDamage true;
	life_iztazed = false;
};

 

Next, create a new file called fn_tazeRagdoll, place it in core -> session

Put the following into it:

if (!isNull objectParent player) exitWith {};
private "_tazered";
_tazered = "Land_Can_V3_F" createVehicleLocal [0,0,0];
_tazered setMass 1e10;
_tazered attachTo [player, [0,0,0], "Spine3"];
_tazered setVelocity [0,0,6];
detach _tazered;
0 = _tazered spawn {
	deleteVehicle _this;
};

Call this function in functions.h

under file = "System\session"; place:

class tazeRagdoll {};

 

Tell me how it works.

 

Hi Repentz i enjoy the work u post but i need help on something i was good unit i got to this place

Call this function in functions.h

under file = "System\session"; place: 

What do you mean by system Do you mean "Root" ??

I'm sorry if is is something obvious but i'm new at this.

Share this post


Link to post
Share on other sites
6 hours ago, NatanBrody said:

Goddammit thew second that I make my own script for this someone else puts it up XD. Good work buddy!

If you have any improvements feel free to post em and i can change it up

Share this post


Link to post
Share on other sites
On 12/11/2016 at 6:25 AM, Repentz said:

_unit allowDamage true; life_iztazed = false;

iztazed ^^ ?

EDIT: Look like vanilla bug ^^

Edited by Nark0t1k

Share this post


Link to post
Share on other sites

so has the original script been edited with the fix for  fn_forceRagdoll.sqf  or do i need to change my sqf to that from  fn_tazeRagdol.sf

 

Thanks :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...