Ace3: Allowing to disable fall damage with ACE Medical

Created on 12 Jan 2020  路  5Comments  路  Source: acemod/ACE3

Is your enhancement related to a problem?
Yes, I'm trying to integrate Exoskeleton mod with ACE Medical by disabling fall damage while wearing it but even simple event handler player addEventHandler ["HandleDamage", {0}]; still makes any player take damage after falling.

Solution you'd like:
Either an option to set minimal height to take fall damage or any kind of cooperation with BIS event handlers.

Alternatives you've considered:
Using ACE with Project Injury Reaction instead of ACE Medical files which works perfectly.

Additional context:
Add any other context or screenshots about the enhancement here.

kinenhancement kinquestion statustale

All 5 comments

Right now we don't offer the option to disable officially, maybe in the future
but there are ways to do it via code
this is not officially supported and very hacky, I am just trying to help
variables/funcs might change in the future and break

this code removes ace's HD and adds a custom one, with the option to pass on to ace

["CAManBase", "init", {
    params ["_unit"];

   // ace stores its HD id as a setVar
    private _aceID = _unit getVariable ["ace_medical_HandleDamageEHID", -1];
    diag_log text format ["ace HD ID: %1", _aceID];

    // remove ace HD and add your custom one
    _unit removeEventHandler ["HandleDamage", _aceID];
    _unit addEventHandler ["HandleDamage", {
        diag_log text format ["HD: %1", _this];

        params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex", "_instigator", "_hitpoint"];
        private _oldDamage = if (_hitPoint isEqualTo "") then {
            damage _unit;
        } else {
            _unit getHitIndex _hitPointIndex;
        };

        if (_ammo == "") then { // probably falling??
            // by passing oldDamage we "should" keep status effects like limping/bleeding
            diag_log "ignore - keep old damage";
            _oldDamage
        } else {
            diag_log "pass to ace";
            _this call ACE_medical_engine_fnc_handleDamage
        };
    }];
}, nil, [], true] call CBA_fnc_addClassEventHandler;

edit: make sure to call this after ace's postInit or the var might not be set yet

Feel free to join our public slack for more discussion on this

Right now we don't offer the option to disable officially, maybe in the future
but there are ways to do it via code
this is not officially supported and very hacky, I am just trying to help
variables/funcs might change in the future and break

this code removes ace's HD and adds a custom one, with the option to pass on to ace

["CAManBase", "init", {
    params ["_unit"];

   // ace stores its HD id as a setVar
    private _aceID = _unit getVariable ["ace_medical_HandleDamageEHID", -1];
    diag_log text format ["ace HD ID: %1", _aceID];

    // remove ace HD and add your custom one
    _unit removeEventHandler ["HandleDamage", _aceID];
    _unit addEventHandler ["HandleDamage", {
        diag_log text format ["HD: %1", _this];

        params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex", "_instigator", "_hitpoint"];
        private _oldDamage = if (_hitPoint isEqualTo "") then {
            damage _unit;
        } else {
            _unit getHitIndex _hitPointIndex;
        };

        if (_ammo == "") then { // probably falling??
            // by passing oldDamage we "should" keep status effects like limping/bleeding
            diag_log "ignore - keep old damage";
            _oldDamage
        } else {
            diag_log "pass to ace";
            _this call ACE_medical_engine_fnc_handleDamage
        };
    }];
}, nil, [], true] call CBA_fnc_addClassEventHandler;

edit: make sure to call this after ace's postInit or the var might not be set yet

Feel free to join our public slack for more discussion on this

Is this only disable fall damage or the ever collision damage? I think I tried this one before and it also disable ever collision damage in game, like been hit by a car would not do damage to the unit.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This is a valid feature request I'd say, adding an option for that

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

austinjames314 picture austinjames314  路  4Comments

DieselJC picture DieselJC  路  3Comments

Snak3Doc picture Snak3Doc  路  4Comments

BlueNexus picture BlueNexus  路  3Comments

lividsubset3 picture lividsubset3  路  3Comments