Jump to content
  • 0

Take no damage if no vehicle is within 25m


azzdayz

Question

Hey guys, I am needing some help to disable this. I want to be able to have a script execute "HelicopterExploSmall" or "HelicopterExploBig". Doesn't matter I am wanting it to cause damage regardless what I use. I have found though that damage is canceled if there is no vehicle within 25m of the explosion.

My question is how can I disable that? I found the below code in fn_damageHandler.sqf, but I tried commenting out the whole code and I was still not taking damage.

Spoiler

//Simple hack to help with a few issues from direct damage to physic based damage. ***until 2.0***
    if (isNull dayz_getout) then {
        _vehicleArray = nearestObjects [(getPosATL (vehicle _unit)),["Car","Air","Motorcycle","Ship","Tank"],3];
        {if (typeOf _x == "ParachuteWest") then {_vehicleArray = _vehicleArray - [_x];};} count _vehicleArray;
        {
            if ((speed _x > 10) or (speed _x < -8)) exitwith { dayz_HitBy = _x; };
        } count _vehicleArray;
    };

    //Lets see if the player has been struck by a moving vehicle.
    if (!isNull dayz_HitBy && vehicle player == player) then { _ammo = "RunOver"; };
    if ((_hit == "Legs") AND {(_ammo == "RunOver")}) then { dayz_HitBy = objNull; };

    //If a vehicle is moveing faster then 15 lets register some kind of direct damage rather then relying on indirect/physics damage.
    if (!isNull dayz_getout && diag_tickTime - dayz_getoutTime < 5) then { _ammo = "Dragged"; };
    if ((_hit == "Legs") AND {(_ammo == "Dragged")}) then { dayz_getout = objNull; };

    _end = false;

    if (!_falling) then {
        if (_ammo == "" && _hit == "" && vehicle player != player) then {_ammo = "Crash";};
        //No _ammo type exit, indirect/physics damage.
        if (_ammo == "") exitwith { _end = true; };
        
        //If _source contains no object exit. But lets not exit if the unit returns player. Maybe its his own fault.
        if (isNull _source && !(_ammo in ["Dragged","RunOver"])) then {
            _vehicleArray = nearestObjects [(getPosATL (vehicle _unit)),["Car","Air","Motorcycle","Ship","Tank","TrapTripwireGrenade"],25];
            {if (typeOf _x == "ParachuteWest") then {_vehicleArray = _vehicleArray - [_x];};} count _vehicleArray;
            
            //Don't exit if a drivable vehicle (or drivable vehicle wreck) is nearby, because vehicle explosions register as a null source
            if (count _vehicleArray == 0) then {
                _end = true;
                /*
                    Possible cheat. Record to block any incoming fall damage.
                    NOTE: Only vehicle explosions register a null source. Satchel charges, mines, grenades, vehicle missiles
                    and other explosives DO NOT register a null source. UNLESS they are spawned manually via script (i.e. tripwire grenade),
                    their source is always the player who placed, threw or fired them.
                */
                dayz_lastDamageSourceNull = true;
                diag_log "Warning: Fn_DamageHandler source isNull with no drivable vehicle (or drivable vehicle wreck) in 25m radius. Exiting with no damage.";
            };
            
        };
    } else {
        if (dayz_lastDamageSourceNull) then { _end = true; }; // Block incoming fall damage.
    };


    if (_end) exitwith { 0 };
//End Simple hack for damage ***until 2.0***

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Commenting out those two lines didn't seem to work. The explosion goes off, but no damage. I have infiSTAR turned off for now to make sure that's not blocking anything. Is there something else I could be using other than  "HelicopterExploSmall" that would work?

SOLVED - Your edits did work, but my safezone script was overriding it. That also explains why everything I was trying was doing nothing ;/ Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...