Jump to content
Fr3eMan

Disable penetration of bullets/shrapnel plywood

Recommended Posts

HI all!
I'm working on a script to create a kill house, and I want to use the plywood panels of editor for create the area, and I don't want allow the bullets to pass the panels, but also if I set it as:

_pos = [_pos1,_pos2,_pos3,_pos4,_pos5];
{
    _veh = createVehicle ["Land_Shoot_House_Wall_F", _x, [], 0, "CAN_COLLIDE"];
    _veh allowDamage false;
    _veh enableSimulation false;
    _veh setDir 14.5;
}foreach _pos;

The bullets can anyway pass it and can hit the objects/unit on the other side, any suggestion?

 

Share this post


Link to post
Share on other sites

Might be doable.

Using a hit or hitpart eventhandler on the object, hitpart EH would even return the surfaceType.

 

Cheers

Share this post


Link to post
Share on other sites
Guest

Maybe multiplicating the number of objects (may be a performance killer). Or adding invisible walls. (They may be too thick)

Share this post


Link to post
Share on other sites

Might be doable.

Using a hit or hitpart eventhandler on the object, hitpart EH would even return the surfaceType.

 

Cheers

 

I try with this but dasn't work properly:

_veh addEventHandler ["HitPart", {deleteVehicle (_this select 2);}];

Share this post


Link to post
Share on other sites
Guest

Try creating them as simple objects instead of vehicles, maybe.

This guy ^

Share this post


Link to post
Share on other sites

Try creating them as simple objects instead of vehicles, maybe.

 

I tried, doesn't work, create as:

_simpleVeh = createSimpleObject [_model, _position]

Share this post


Link to post
Share on other sites

He is right, simple object retains penetration properties. Trying to stop bullet on "HitPart" also doesn't work, seems like it fires a bit too late. Changing object material is also a no go. So basically last resort - make a mod and alter object properties as you like.

  • Like 1

Share this post


Link to post
Share on other sites

Be more specific, what doesn't work?

Creation?

Bullet penetration?

 

Cheers

 

In every way I try to create the object/vehicle "Land_Shoot_House_Wall_F" (plywood panels) is unable to stop the bullet/shrapnel penetration

 

 

So basically last resort - make a mod and alter object properties as you like.

 

Unfortunately, looks like the only solution...

Share this post


Link to post
Share on other sites
Guest

Did you try to stack x objects on the same pos

Share this post


Link to post
Share on other sites

Did you try to stack x objects on the same pos

 

Yes, don't work anyway.

Share this post


Link to post
Share on other sites
Guest

If only we could overwrite / create new configs directly in the mission...

Share this post


Link to post
Share on other sites

So if one is to create a config for these walls to make them bulletproof what properties should be changed?

Share this post


Link to post
Share on other sites

This doesn't answers b3lx's question, but another possibility for original posted problem is to add an onFired eventhandlers to units in kill house that detects the bullet and reduces the velocity by 5X or 10X.   You could also replace the projectile with a spawned SDAR projectile which is the weakest I know of.  My theory that a small enough projectile with a low velocity might not penetrate.  Someone would have to experiment with it.

 

Killhouses should be short range situations, so reduced velocity is unlikely to be noticed by players.

 

UPDATE:  I remembered "solving" this issue for my JBOY Beanbag Shotgun script.  I would replace fired projectile with SDAR bullet, and reduce its velocity and attach visible bandage object to represent the bean bag.  Originally I had problems with "bean bag" penetrating car windows and thin walls, and used this code to solve it.   In this code I have stripped out all the bean bag related code, and only kept the bullet replacement and reduced velocity parts.

_shooter addEventHandler 
["fired",
    {
        _shooter = _this select 0;
            _bulletType = _this select 4;
            _projectile = nearestObject [_this select 0, _bulletType];
             _bullet = "B_556x45_dual" createVehicle [0,0,1];  // using weak sdar underwater bullet for beanbag hit
            _pos = _projectile modelToWorld [0,0,0]; 
            _dir = getdir _projectile;
            _vel = velocity _projectile;
            _vdir = vectorDir _projectile;
            _vup = vectorUp _projectile;
            _velModelSpace = velocityModelSpace _projectile;
            _projectile setpos [0,0,0];
			// ****************************************************
			// Tweak this _bulletSpeed value until you don't get penetration on thin walls,
			// but hopefully keep the value high enough so player doesn't notice bullet drop in short range.
			// ****************************************************
			_bulletSpeed = 30;
            _velModelSpace = [_velModelSpace select 0, _bulletSpeed, _velModelSpace select 2];
            _bullet setdir _dir;
            _bullet setVectorDirAndUp [_vdir,_vup];
            _bullet setpos _pos;
            _bullet setVelocityModelSpace _velModelSpace;
    }
]; 

 

Here's the beanbag eventhandler complete code for reference,. 

Spoiler

//JBOY_addBeanbagFiredEH.sqf
params["_shooter","_startLoadedWithBeanBag"];

if (_startLoadedWithBeanBag) then 
{
    _shooter setVariable ["JBOY_BeanBagActive", true, true];
    hintsilent composeText [parsetext format["<t size='1' align='center' color='#00FF00'>Shotgun Status: Non-Lethal Beanbags%1</t>"]]; 
} else
{
    _shooter setVariable ["JBOY_BeanBagActive", false, true];
    hintsilent composeText [parsetext format["<t size='1' align='center' color='#FF0000'>Shotgun Status: Lethal%1</t>"]]; 
};
_action = _shooter addAction 
[   "Reload/Toggle shotgun shells/beanbags", 
    {
         _shooter=(_this select 3) select 0; 
         _shooter playActionNow "reloadMagazine"; 
         _beanBagActive = _shooter getVariable "JBOY_BeanBagActive";
         if (_beanBagActive) then
         {
            _shooter setVariable ["JBOY_BeanBagActive", false, true];
            hintsilent composeText [parsetext format["<t size='1' align='center' color='#FF0000'>Shotgun Status: Lethal%1</t>"]]; 
         } else 
         {
            _shooter setVariable ["JBOY_BeanBagActive", true, true];
            hintsilent composeText [parsetext format["<t size='1' align='center' color='#00FF00'>Shotgun Status: Non-Lethal Beanbags%1</t>"]]; 
         };
     }, // script
        [_shooter], //arguments
        6, // priority
        false, //showWindow
        false, //hideOnUse
        "",//shortcut
        "currentWeapon _target == JBOY_BeanbagShotgun",//condition 
        2//radius]
 ];

// Add Fired EH to substitute Buckshot for simulated Bean Bag.
// This only works if victims have the corresponding HandleDamage EH that puts them in an unconcious state.
_shooter addEventHandler 
["fired",
    {
        //systemchat str _this;
        //copyToClipboard str _this;
        _shooter = _this select 0;
diag_log format ["_this select 4=%1, JBOY_BeanbagProjectile=%2, JBOY_BeanBagActive=%3",_this select 4,JBOY_BeanbagProjectile, _shooter getVariable "JBOY_BeanBagActive"],;
        if (_this select 4 == JBOY_BeanbagProjectile and (_shooter getVariable "JBOY_BeanBagActive")) then 
        {
            //systemchat "shooting beanbag";
            _bulletType = _this select 4;
            _projectile = nearestObject [_this select 0, _bulletType];
            _obj_to_create  = "Land_Bandage_F"; // bean bag proxy...maybe someone will donate a .p3d?
            _beanbag = _obj_to_create createVehicle [0,0,0];
            _beanbag setVariable ["shooter",_shooter,true];
            _beanbag enableCollisionWith _projectile;
            _beanbag enableCollisionWith _shooter;
            _beanbag allowdamage false;
            _bullet = "B_556x45_dual" createVehicle [0,0,1];  // using weak sdar underwater bullet for beanbag hit
            _beanbag enableCollisionWith _bullet;
            {_beanbag enableCollisionWith _x} foreach nearestObjects [_shooter, ["Car","Tank","Truck"], 30];; 
            _beanbag setMass .00001;
            _pos = _projectile modelToWorld [0,0,0]; 
            _dir = getdir _projectile;
            _vel = velocity _projectile;
            _vdir = vectorDir _projectile;
            _vup = vectorUp _projectile;
            _velModelSpace = velocityModelSpace _projectile;
            _projectile setpos [0,0,0];
            _velModelSpace = [_velModelSpace select 0, 60, _velModelSpace select 2];
            _beanbag setdir _dir;
            _beanbag setVectorDirAndUp [_vdir,_vup];
            _bullet setdir _dir;
            _bullet setVectorDirAndUp [_vdir,_vup];
            _bullet setpos _pos;
            _bullet setVelocityModelSpace _velModelSpace;
            
            _beanbag setpos _pos;
            //_beanBag enableSimulation false;
            _beanBag attachTo [_bullet,[0,-.2,-.02]];
            
            _d = [_bullet,_beanbag, _velModelSpace,_shooter] spawn 
            {
                params ["_bullet","_beanbag","_velModelSpace","_shooter"]; 
                sleep .1; 
                _bulletDir = getdir _bullet + 180;
                _pos = getpos _beanBag;
                _prevPos = _pos;
                //_dir = getdir _bullet;
                //_dirTo = _dir;
                _speed = speed _bullet;
                _prevSpeed = speed _bullet;
                // getpos select 0 on a bullet returns zero when bullet no longer exists (i.e.) hit something
                //waituntil {getpos _bullet select 0 == 0};   
                // ******************************************
                // While loop uses speed reduction for detecting impact.  This combined with attaching beanbag behind the 
                // bullet prevented beanbag penetrating thin walls.   Not sure which is better...?
                _startTime = time;
                 //while { ( (_pos select 2) > .01) and (abs(_prevSpeed - _speed) < .0001) and time < (_startTime + .01)} do 
                 while { !(getpos _bullet select 0 == 0)} do 
                {
                   _prevPos = _pos;
                   _prevSpeed = _speed;
                   //sleep .05;
                   _pos = getpos _bullet;
                   //_pos = getpos _beanbag;
                   _speed = speed _bullet;
                   //_dirTo = [_prevpos, _pos] call BIS_fnc_dirTo; // if ricochet, then dir to previous pos will differ from dir alot.
                   //_dir = getdir _bullet;
                };   // end while
                _beanbag setpos _prevpos;

                detach _beanbag;
                //{_beanbag enableCollisionWith _x} foreach nearestObjects [_beanbag, ["Man"], 3];;            

                _beanBag enableSimulation true;
                _beanbag setVelocity [0,0,0];
                _speed = 1.5;
                if (getpos _beanbag select 2 > .2) then 
                {
                    _bulletDir = _bulletDir + 30-random(60);
                    _beanbag setVelocity [_speed * sin(_bulletDir), _speed * cos(_bulletDir),   .3+((random 4)/10)];  // bounces beanbag back after impact
                };
                //waituntil {getpos _beanbag select 2 <.1};
                sleep 20; 
                deleteVehicle _beanbag;
            };
            
        };
    }
]; 

 

 

  • Like 2

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

×