Jump to content
Sign in to follow this  
JohnsonTFB

Weapons damage

Recommended Posts

Is there a script that you can use to limit the damage done to a player/object. to get a low velocity ammunition or less lethal that can be used for live fire training.

Alternatively used with ACE have a script when used with low velocity ammunition: if shot, you would require a shot of epinephrine, instead of the morphine and bandage required after take a live round, in the unlikelihood that you don't die from your wounds

Share this post


Link to post
Share on other sites

Put this in the soldier's init box:

this addEventHandler ["Fired",{_this execVM "boost.sqf"}]

boost.sqf:

_unit=_this select 0;
_bullet=nearestObject [_unit,_this select 4];

if (speed _bullet<500) exitwith{};

_power=0.5;

_vel=[(velocity _bullet select 0)*_power,(velocity _bullet select 1)*_power,(velocity _bullet select 2)*_power)];
_bullet setVelocity _vel;

_power is the multiplier; edit the value to get the velocity you want.

Share this post


Link to post
Share on other sites

Thanks,

Is it possible to have the function relate to the weapon, not the person. so other weapons perform normally.

ie

M16A2: "_power=1.0;"

M16A4: "_power=0.5;"

Share this post


Link to post
Share on other sites

Sure.

_unit=_this select 0;
_weapon=_this select 1;
_bullet=nearestObject [_unit,_this select 4];

if (speed _bullet<500) exitwith{};

if (_weapon=="M16A4") then {_power=0.5;} else {_power=1;};

_vel=[(velocity _bullet select 0)*_power,(velocity _bullet select 1)*_power,(velocity _bullet select 2)*_power)];
_bullet setVelocity _vel;

Addendum: you still have to add the event handler to everyone because there isn't another way of detecting shots when they're fired.

Edited by Celery

Share this post


Link to post
Share on other sites

well...

do i need any other files or statements in order to get this script to run?

sorry for the n00bish question

Share this post


Link to post
Share on other sites

The script was a bit badly written, sorry about that.

Try this:

_unit=_this select 0;
_weapon=_this select 1;
_bullet=nearestObject [_unit,_this select 4];

if (speed _bullet<500) exitwith{};

_power=1;
if (_weapon=="m16a4") then {_power=0.4;};

_bullet setVelocity [(velocity _bullet select 0)*_power,(velocity _bullet select 1)*_power,(velocity _bullet select 2)*_power];

Share this post


Link to post
Share on other sites
The script was a bit badly written, sorry about that.

Try this:

_unit=_this select 0;
_weapon=_this select 1;
_bullet=nearestObject [_unit,_this select 4];

if (speed _bullet<500) exitwith{};

_power=1;
if (_weapon=="m16a4") then {_power=0.4;};

_bullet setVelocity [(velocity _bullet select 0)*_power,(velocity _bullet select 1)*_power,(velocity _bullet select 2)*_power];

so drop this "boost.sqf" into my mission file and boot it up and it should work, i dont need any other filles other than the mission file and the boost.sqf file?

Share this post


Link to post
Share on other sites
;1575357']so drop this "boost.sqf" into my mission file and boot it up and it should work' date=' i dont need any other filles other than the mission file and the boost.sqf file?[/quote']

That's right. And the init command for every soldier.

Share this post


Link to post
Share on other sites

It should work with boost.sqf in the mission folder. When you fire the vanilla M16A4 with aimpoint, it takes multiple hits to kill a man.

Share this post


Link to post
Share on other sites

Check the weapon classnames. I suspect ACE altered them:

hint str (weapons this);

- init line of the unit wielding the gun in question.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×