Jump to content
Sign in to follow this  
thecoolsideofthepillow

Locking Building Doors?

Recommended Posts

I was thinking about this feature on some Life servers where you can own a house in Altis, and it allows you to lock the doors to the building.

 

Now, I don't really care about home ownership in the game, but locking doors for an enemy stronghold would be insanely fun to work with.

 

I'm just not sure how I would even do that. The doors are first of all not vehicles, so AFAIK they don't have the built in lock-out system available to them, and secondly, they are pre-placed on the map; I don't know if the *doors* have unique names I can work with, just the entire building.

 

The only way I know I could lock a door now (and perhaps it's how those Life servers work for all I know) would be to spawn an object on the otherside of the door to prevent it from opening, since the doors won't clip through objects and then delete the object when the condition to open the door is met. I was hoping there was a more elegant and non-immersion breaking method instead. The buildings I am using are the Takistan style ones, so a lot of the times you can see the other side of the door through a window; I think it would be weird to see an H block or something barring the door until you had the key.

Share this post


Link to post
Share on other sites

Now, in case this doesn't work with the map(s) I have in mind, how would I find the door name to add to this script's custom list of door names? My usual method of looking at the thing and having a hint tell me what the cursorTarget is just shows me the building name (if not <<NULL-OBJECT>>)

Share this post


Link to post
Share on other sites

Not sure... haven't dug into the script much...

He has updated since I couldn't get it working on Tak but I haven't had time to test...

Share this post


Link to post
Share on other sites

private _building = cursorObject;
private _numberofdoors = getNumber(configFile >> "CfgVehicles" >> (typeOf _building) >> "numberOfDoors");
if(_numberofdoors == -1 OR _numberofdoors == 0) exitWith {}; //No entry (Not a compatible building)
 
for "_i" from 1 to _numberOfDoors do {
    _building animate[format["door_%1_rot",_i],0];
    _building setVariable[format["bis_disabled_Door_%1",_i],1,true];
};

 

This will lock all doors of the current building you look at, gives you an idea of how to do it. Locking doors only works for A3 vanillia buildings and not ports like Zargabad, Takistan or 3rd party maps that do not have the proper config entries. To make the old maps like Zargabad and Takistan be able to have lockable doors you'll have to create a separate addon with this as the config.cpp:

 

class CfgPatches
{
    class a3mp_houseFixes
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"CAStructures_E_houseA"};
    };
};
class CfgVehicles {
    class House;
    class House_EP1: House {
        class DestructionEffects;
    };
    class Land_House_K_3_EP1: House_EP1 {
        numberOfDoors = 3;
        class UserActions {
            class OpenDoors1 {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1 {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1 {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0]";
            };
            class CloseDoors2: CloseDoors1 {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1]";
            };
            class OpenDoors3: OpenDoors1 {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" >= 0.5 AND (this getVariable[""bis_disabled_Door_3"",0]) == 0";
                statement = "this animate [""Dvere3"", 0]";
            };
            class CloseDoors3: CloseDoors1 {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" < 0.5";
                statement = "this animate [""Dvere3"", 1]";
            };
        };
    };
    class Land_House_K_7_EP1: House_EP1 {
        numberOfDoors = 4;
        class UserActions {
            class OpenDoors1 {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1]";
            };
            class OpenDoors3: OpenDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" >= 0.5 AND (this getVariable[""bis_disabled_Door_3"",0]) == 0";
                statement = "this animate [""Dvere3"", 0]";
            };
            class CloseDoors3: CloseDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" < 0.5";
                statement = "this animate [""Dvere3"", 1]";
            };
            class OpenDoors4: OpenDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" >= 0.5 AND (this getVariable[""bis_disabled_Door_4"",0]) == 0";
                statement = "this animate [""Dvere4"", 0]";
            };
            class CloseDoors4: CloseDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" < 0.5";
                statement = "this animate [""Dvere4"", 1]";
            };
        };
    };
    class Land_House_C_10_EP1: House_EP1
    {
        numberOfDoors = 8;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1]";
            };
            class OpenDoors3: OpenDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" >= 0.5 AND (this getVariable[""bis_disabled_Door_3"",0]) == 0";
                statement = "this animate [""Dvere3"", 0]";
            };
            class CloseDoors3: CloseDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" < 0.5";
                statement = "this animate [""Dvere3"", 1]";
            };
            class OpenDoors4: OpenDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" >= 0.5 AND (this getVariable[""bis_disabled_Door_4"",0]) == 0";
                statement = "this animate [""Dvere4"", 0]";
            };
            class CloseDoors4: CloseDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" < 0.5";
                statement = "this animate [""Dvere4"", 1]";
            };
            class OpenDoors5: OpenDoors1
            {
                position = "osa Door_5";
                condition = "this animationPhase ""Dvere5"" >= 0.5 AND (this getVariable[""bis_disabled_Door_5"",0]) == 0";
                statement = "this animate [""Dvere5"", 0]";
            };
            class CloseDoors5: CloseDoors1
            {
                position = "osa Door_5";
                condition = "this animationPhase ""Dvere5"" < 0.5";
                statement = "this animate [""Dvere5"", 1]";
            };
            class OpenDoors6: OpenDoors1
            {
                position = "osa Door_6";
                condition = "this animationPhase ""Dvere6"" >= 0.5 AND (this getVariable[""bis_disabled_Door_6"",0]) == 0";
                statement = "this animate [""Dvere6"", 0]";
            };
            class CloseDoors6: CloseDoors1
            {
                position = "osa Door_6";
                condition = "this animationPhase ""Dvere6"" < 0.5";
                statement = "this animate [""Dvere6"", 1]";
            };
            class OpenDoors7: OpenDoors1
            {
                position = "osa Door_7";
                condition = "this animationPhase ""Dvere7"" >= 0.5 AND (this getVariable[""bis_disabled_Door_7"",0]) == 0";
                statement = "this animate [""Dvere7"", 0]";
            };
            class CloseDoors7: CloseDoors1
            {
                position = "osa Door_7";
                condition = "this animationPhase ""Dvere7"" < 0.5";
                statement = "this animate [""Dvere7"", 1]";
            };
            class OpenDoors8: OpenDoors1
            {
                position = "osa Door_8";
                condition = "this animationPhase ""Dvere8"" >= 0.5 AND (this getVariable[""bis_disabled_Door_8"",0]) == 0";
                statement = "this animate [""Dvere8"", 0]";
            };
            class CloseDoors8: CloseDoors1
            {
                position = "osa Door_8";
                condition = "this animationPhase ""Dvere8"" < 0.5";
                statement = "this animate [""Dvere8"", 1]";
            };
        };
    };
    class Land_House_K_1_EP1: House_EP1
    {
        numberOfDoors = 1;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
        };
    };
    class Land_Wall_L3_gate_EP1: House_EP1
    {
        numberOfDoors = 2;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 1];this animate [""Dvere2"", 1]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5";
                statement = "this animate [""Dvere1"", 0];this animate [""Dvere2"", 0]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 1];this animate [""Dvere1"", 1]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5";
                statement = "this animate [""Dvere2"", 0];this animate [""Dvere1"", 0]";
            };
        };
    };
    class Land_House_L_6_EP1: House_EP1
    {
        numberOfDoors = 1;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
        };
    };
    class Land_House_C_5_V3_EP1: House_EP1
    {
        numberOfDoors = 2;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0];this animate [""Dvere3"", 0]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1];this animate [""Dvere3"", 1]";
            };
        };
    };
    class Land_House_L_3_EP1: House_EP1
    {
        numberOfDoors = 2;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0];this animate [""Dvere3"", 0]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1];this animate [""Dvere3"", 1]";
            };
        };
    };
    class Land_A_Villa_EP1: House_EP1
    {
        numberOfDoors = 12;
        class UserActions
        {
            class OpenDoors1
            {
                displayNameDefault = "$STR_DN_OUT_O_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_O_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" >= 0.5 AND (this getVariable[""bis_disabled_Door_1"",0]) == 0";
                statement = "this animate [""Dvere1"", 0]";
            };
            class CloseDoors1
            {
                displayNameDefault = "$STR_DN_OUT_C_DOOR_DEFAULT";
                displayName = "$STR_DN_OUT_C_DOOR";
                position = "osa Door_1";
                radius = 2;
                onlyForPlayer = 0;
                condition = "this animationPhase ""Dvere1"" < 0.5";
                statement = "this animate [""Dvere1"", 1]";
            };
            class OpenDoors2: OpenDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" >= 0.5 AND (this getVariable[""bis_disabled_Door_2"",0]) == 0";
                statement = "this animate [""Dvere2"", 0]";
            };
            class CloseDoors2: CloseDoors1
            {
                position = "osa Door_2";
                condition = "this animationPhase ""Dvere2"" < 0.5";
                statement = "this animate [""Dvere2"", 1]";
            };
            class OpenDoors3: OpenDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" >= 0.5 AND (this getVariable[""bis_disabled_Door_3"",0]) == 0";
                statement = "this animate [""Dvere3"", 0]";
            };
            class CloseDoors3: CloseDoors1
            {
                position = "osa Door_3";
                condition = "this animationPhase ""Dvere3"" < 0.5";
                statement = "this animate [""Dvere3"", 1]";
            };
            class OpenDoors4: OpenDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" >= 0.5 AND (this getVariable[""bis_disabled_Door_4"",0]) == 0";
                statement = "this animate [""Dvere4"", 0]";
            };
            class CloseDoors4: CloseDoors1
            {
                position = "osa Door_4";
                condition = "this animationPhase ""Dvere4"" < 0.5";
                statement = "this animate [""Dvere4"", 1]";
            };
            class OpenDoors5: OpenDoors1
            {
                position = "osa Door_5";
                condition = "this animationPhase ""Dvere5"" >= 0.5 AND (this getVariable[""bis_disabled_Door_5"",0]) == 0";
                statement = "this animate [""Dvere5"", 0]";
            };
            class CloseDoors5: CloseDoors1
            {
                position = "osa Door_5";
                condition = "this animationPhase ""Dvere5"" < 0.5";
                statement = "this animate [""Dvere5"", 1]";
            };
            class OpenDoors6: OpenDoors1
            {
                position = "osa Door_6";
                condition = "this animationPhase ""Dvere6"" >= 0.5 AND (this getVariable[""bis_disabled_Door_6"",0]) == 0";
                statement = "this animate [""Dvere6"", 0]";
            };
            class CloseDoors6: CloseDoors1
            {
                position = "osa Door_6";
                condition = "this animationPhase ""Dvere6"" < 0.5";
                statement = "this animate [""Dvere6"", 1]";
            };
            class OpenDoors7: OpenDoors1
            {
                position = "osa Door_7";
                condition = "this animationPhase ""Dvere7"" >= 0.5 AND (this getVariable[""bis_disabled_Door_7"",0]) == 0";
                statement = "this animate [""Dvere7"", 0]";
            };
            class CloseDoors7: CloseDoors1
            {
                position = "osa Door_7";
                condition = "this animationPhase ""Dvere7"" < 0.5";
                statement = "this animate [""Dvere7"", 1]";
            };
            class OpenDoors8: OpenDoors1
            {
                position = "osa Door_8";
                condition = "this animationPhase ""Dvere8"" >= 0.5 AND (this getVariable[""bis_disabled_Door_8"",0]) == 0";
                statement = "this animate [""Dvere8"", 0]";
            };
            class CloseDoors8: CloseDoors1
            {
                position = "osa Door_8";
                condition = "this animationPhase ""Dvere8"" < 0.5";
                statement = "this animate [""Dvere8"", 1]";
            };
            class OpenDoors9: OpenDoors1
            {
                position = "osa Door_9";
                condition = "this animationPhase ""Dvere9"" >= 0.5 AND (this getVariable[""bis_disabled_Door_9"",0]) == 0";
                statement = "this animate [""Dvere9"", 0]";
            };
            class CloseDoors9: CloseDoors1
            {
                position = "osa Door_9";
                condition = "this animationPhase ""Dvere9"" < 0.5";
                statement = "this animate [""Dvere9"", 1]";
            };
            class OpenDoors10: OpenDoors1
            {
                position = "osa Door_10";
                condition = "this animationPhase ""Dvere10"" >= 0.5 AND (this getVariable[""bis_disabled_Door_10"",0]) == 0";
                statement = "this animate [""Dvere10"", 0]";
            };
            class CloseDoors10: CloseDoors1
            {
                position = "osa Door_10";
                condition = "this animationPhase ""Dvere10"" < 0.5";
                statement = "this animate [""Dvere10"", 1]";
            };
            class OpenDoors11: OpenDoors1
            {
                position = "osa Door_11";
                condition = "this animationPhase ""Dvere11"" >= 0.5 AND (this getVariable[""bis_disabled_Door_11"",0]) == 0";
                statement = "this animate [""Dvere11"", 0]";
            };
            class CloseDoors11: CloseDoors1
            {
                position = "osa Door_11";
                condition = "this animationPhase ""Dvere11"" < 0.5";
                statement = "this animate [""Dvere11"", 1]";
            };
            class OpenDoors12: OpenDoors1
            {
                position = "osa Door_12";
                condition = "this animationPhase ""Dvere12"" >= 0.5 AND (this getVariable[""bis_disabled_Door_12"",0]) == 0";
                statement = "this animate [""Dvere12"", 0]";
            };
            class CloseDoors12: CloseDoors1
            {
                position = "osa Door_12";
                condition = "this animationPhase ""Dvere12"" < 0.5";
                statement = "this animate [""Dvere12"", 1]";
            };
        };
    };
};

 

If the map you are wanting to do this with does not use A3 buildings or A2 buildings (with this above applied) then you'll have to submit the text above to the map author to have them adjust the door actions to be similar to the code above. I sent this code into the person that worked on A3MP and then Kju that did AllInArma and no one ever implemented it so meh.

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  

×