Jump to content
Sign in to follow this  
pierremgi

"Just for fun" script

Recommended Posts

Little script to throw away the helmet of a unit when hit by a bullet

(in init field of the unit)


 

this addEventHandler ["handledamage", {
  params ["_unit","_part","_dam","_shooter"];
  if (_part == "head" && _dam > 0.4 && headgear _unit != "" && local _unit) exitWith {
    _h = headgear _unit;
    removeHeadgear _unit;
    _g = goggles _unit;
    removeGoggles _unit;
    _nv = ((assignedItems _unit) select {_x find "NV" > -1}) select 0;
    _unit unlinkItem _nv;
    _w = createVehicle ["WeaponHolderSimulated",ASLtoATL eyePos _unit, [], 0, "CAN_COLLIDE"];
    _w addItemCargoGlobal [_h,1];
    _w addItemCargoGlobal [_g,1];
    _w addItemCargoGlobal [_nv,1];
    _w setVelocity [5 * sin (_shooter getdir _unit), 5 * cos (_shooter getDir _unit), 0.3];
    _w addTorque [random 0.02, random .02, random .02];
    0
  }
}];

 

:h:

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

It can be fun... Ive fiddled with it with headgore... were you able to keep the helmet on the ground once it spawned?

 

In some cases the helmet rolls well but in others it sits above the ground...

 

 

  • Like 3

Share this post


Link to post
Share on other sites
14 hours ago, cosmic10r said:

In some cases the helmet rolls well but in others it sits above the ground...

 

Probably due to the addTorque command. If stronger parameters, the weaponholder is stuck in mid air.

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  

×