Jump to content

How to cause damage to player attempting to pick door locks


Bricktop

Recommended Posts

3 hours ago, Bricktop said:

Hello, 

I've seen in the past a script that caused damage to a player when they enter the wrong door code. 

I would like to try it on my server but can't seem to find it anywhere. 

If someone has the link or name of the script I would appreciate some help.

Thanks

im not sure about the script your talking.. but to giving you a being:

1-first at all u will need have a custom compiles.sqf

2-onces u have it find:

player_unlockDoor =  compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";

to make a new player_unlockdoor change by:

player_unlockDoor =  compile preprocessFileLineNumbers "custom\player_unlockDoor.sqf";

3-Drop player_unlockDoor.sqf into mpmissions\your instance\custom\

4-Now into this new custom player_unlockDoor.sqf you need to find where u can set the player damage...(read the script and try to deduce wheres script exit if is a wrong door code)

heres the code you can use for damage:

    r_player_blood = r_player_blood - 100;

***Change -100 to another higer or lower value***

Also you can use     player setDamage 1;    (but this gonna kill the player)

 

player_unlockDoor.sqf   for example (see lines in blue):

Spoiler

/*
    DayZ Unlock Door
    Usage: [_obj] call player_unlockDoor;
    Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_display","_obj","_objectCharacterID"];

if(!isNil "DZE_DYN_UnlockDoorInprogress") exitWith { cutText [(localize "str_epoch_player_21") , "PLAIN DOWN"]; };

DZE_DYN_UnlockDoorInprogress = true;

if(!isNull dayz_selectedDoor) then {

    if (!isNil 'KeyCodeTryTimer') then {
        if(diag_tickTime > KeyCodeTryTimer) then {
            KeyCodeTry = nil;
            KeyCodeTryTimer = nil;
        };
    };

    // our target
    _obj = dayz_selectedDoor;

    _notNearestPlayer = _obj call dze_isnearest_player;

    if (_notNearestPlayer) then {
        // close display since another player is closer
        _display = findDisplay 41144;
        _display closeDisplay 3000;
        cutText [(localize "STR_EPOCH_ACTIONS_16"), "PLAIN DOWN"];
    } else {
    
        // get object combination
        _objectCharacterID     = _obj getVariable ["CharacterID","0"];

        // Check combination
        if (DZE_Lock_Door == _objectCharacterID) then {

            [player,"combo_unlock",0,false] call dayz_zombieSpeak;

            // close display
            _display = findDisplay 41144;
            _display closeDisplay 3000;

            // unlock if locked
            if(_obj animationPhase "Open_hinge" == 0) then {
                _obj animate ["Open_hinge", 1];
            };

            if(_obj animationPhase "Open_latch" == 0) then {
                _obj animate ["Open_latch", 1];
            };
            KeyCodeTry = nil;

        } else {

    r_player_blood = r_player_blood - 100;

            [10,10] call dayz_HungerThirst;

            DZE_Lock_Door = "";
            [player,"combo_locked",0,false] call dayz_zombieSpeak;
            [player,20,true,(getPosATL player)] spawn player_alertZombies;

            if (isNil 'KeyCodeTry') then {KeyCodeTry = 0;};

            KeyCodeTry = KeyCodeTry + 1;

            if (!isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};

            if(KeyCodeTry >= ((round(random 4)) + 4)) then {
            
                if (isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};
            
                cutText [(localize "str_epoch_player_19"), "PLAIN DOWN"];
                _display = findDisplay 41144;
                _display closeDisplay 3000;
            };
        };
    };
} else {
    
    // close display since no target
    _display = findDisplay 41144;
    _display closeDisplay 3000;
};
DZE_DYN_UnlockDoorInprogress = nil;

 

 

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...