Jump to content

Door remote script


Tarabas

Recommended Posts

A few days ago I started to write a script together with my friend PirateLaserBeam to remote gates from vehicles in Epoch.

I was getting great support from the community and He-Man finished that script in a impressing way.

http://plays.tv/video/5aa4580e23dbbbd67b/door-opener

And here it is for first release :

Read readme for install instructions

https://github.com/Ignatz-HeMan/Door-Opener

  Reveal hidden contents
Link to comment
Share on other sites

Can you post the script with all the code (including the group jammer stuff) together?

Also the scanner range should be a lot smaller than 25km... 

Ideally this would not be an action but an automatic thing (maybe, can see reasons why not). I use a script from KillZoneKid for the automatic doors at Karvala Hospital and Altis International Airport. Here's the AIA one:

call {
    if (!isDedicated || worldName != "Altis") exitWith {};
    private ["_fnc","_tr","_side"];
    _fnc = {
        {
            _tr = createTrigger [
                "EmptyDetector",
                _side modelToWorld _x
            ];
            _tr setVariable ["parent", _side];
            _tr setTriggerArea [5, 5, 0, false];
            _tr setTriggerActivation ["ANY", "PRESENT", true];
            _tr setTriggerStatements [
                "this",
                format [
                    "
                        (thisTrigger getVariable 'parent')
                            animate ['Door_%1A_move', 1];
                        (thisTrigger getVariable 'parent') 
                            animate ['Door_%1B_move', 1];
                    ", _forEachIndex + 7
                ],
                format [
                    "
                        (thisTrigger getVariable 'parent') 
                            animate ['Door_%1A_move', 0];
                        (thisTrigger getVariable 'parent') 
                            animate ['Door_%1B_move', 0];
                    ", _forEachIndex + 7
                ]
            ];
            _side setVariable [format [
                "bis_disabled_Door_%1", 
                _forEachIndex + 7
            ], 1, true];
        } forEach _this;
    };
    _side = [14619,16810,0] nearestObject "Land_Airport_left_F";
    [
        [-0.62,-15.16,-7],
        [-0.62,15.16,-7]
    ] call _fnc;
    _side = [14587,16776,0] nearestObject "Land_Airport_right_F";
    [
        [0.62,-15.16,-7],
        [0.62,15.16,-7]
    ] call _fnc;
};

Should be a way to integrate your idea for a auto-door opener with KZK's scripts maybe...? You just set the triggers on found doors to run the code to open them if you are part of the group at the time you come into the trigger's range

Link to comment
Share on other sites

  Reveal hidden contents

Tried to call a EPOCH_Doorcheck .. and if it  at least give me a message, if that one is not called. But didn't even give me that message to go on with that call somehow like that.

 

The scanner range is that big, just to prevent errors in RTP.

 

That automatic script would be a nice idea aswell to test around with. Thank you.

For that it would be nice, if someone can show me how to do the groupcheck right.

Link to comment
Share on other sites

Try this:

_config = 'CfgEpochClient' call EPOCH_returnConfig;
_buildingJammerRange = getNumber(_config >> "buildingJammerRange");
_nearjammers = nearestobjects [player,["Plotpole_EPOCH"],_buildingJammerRange];
if (_nearjammers isEqualTo []) exitwith {
	["You are not in your PlotPole-Range",5] call Epoch_Message;
};
_nearestJammer = _nearjammers select 0;
if !((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) exitwith {
	["You are not in your PlotPole-Range",5] call Epoch_Message;
};

 

Link to comment
Share on other sites

Thank you @He-Man

Gonna go on working with that.

  Reveal hidden contents

 

Link to comment
Share on other sites

The exitwith on the unowned jammer is important because that check in your code @Tarabasjust prints the message and doesn't stop the door opening code from being run... which is why anyone can open the door whether they are in the jammer's group or not. Your actual check was fine it just only affected the printing of messages not the running of the later code.

Also, may be going mad but what is EPOCH_Doorcheck? Did a grep on the mission code/configs and epoch_server... could not find it anywhere... I know of EPOCH_lockcheck which is used by the doors... is that what you meant to use?

Link to comment
Share on other sites

Also, for anyone who wants it, this is KillZoneKid's script for the automatic doors at the hospital in Karvala:

call {
    if (!isDedicated || worldName != "Altis") exitWith {};
    private ["_hs","_var"];
    _hs = [3760,12990,0] nearestObject "Land_Hospital_main_F";
    {
        _var = createTrigger [
            "EmptyDetector",
            _hs modelToWorld _x
        ];
        _var setVariable ["parent", _hs];
        _var setTriggerArea [5, 5, 0, false];
        _var setTriggerActivation ["ANY", "PRESENT", true];
        _var setTriggerStatements [
            "this",
            format [
                "
                    (thisTrigger getVariable 'parent')
                        animate ['Door_%1A_move', 1];
                    (thisTrigger getVariable 'parent') 
                        animate ['Door_%1B_move', 1];
                ", _forEachIndex + 2
            ],
            format [
                "
                    (thisTrigger getVariable 'parent') 
                        animate ['Door_%1A_move', 0];
                    (thisTrigger getVariable 'parent') 
                        animate ['Door_%1B_move', 0];
                ", _forEachIndex + 2
            ]
        ];
        _hs setVariable [format [
            "bis_disabled_Door_%1", 
            _forEachIndex + 2
        ], 1, true];
    } forEach [
        [2.80469,15.7993,-8.47323],
        [2.78027,7.52686,-8.4725],
        [-4.17358,-7.89453,-8.4725]
    ];
};

Run this and the airport one by adding:

if (isServer) then {
	[] execVM "custom\auto_altis_intl_doors.sqf";
	[] execVM "custom\auto_kavala_hospital_doors.sqf";
}; 

to init.sqf with the path and file names matching whatever you called them.

Link to comment
Share on other sites

@Grahame that Epoch_Doorcheck was just a edited EPOCH_isBuildAllowed and only for a test. So it's deleted again.

it seems to be working with @He-Mans addition:

  Reveal hidden contents

Link to comment
Share on other sites

Hey, I have played a bit with this function and have a sample for you.

This Script will check, if you are in your Plotpole-Range and will open / close the nearest handleable visible Door from your Position.

Eventually you have to add some Door classes and add a distance check (if wanted).

To Close the nearest opened Door, just change "_open = true" to "_open = false".

_open = true;
_config = 'CfgEpochClient' call EPOCH_returnConfig;
_buildingJammerRange = getNumber(_config >> "buildingJammerRange");
_nearjammers = nearestobjects [player,["Plotpole_EPOCH"],_buildingJammerRange];
if (_nearjammers isEqualTo []) exitwith {
	["You are not in your PlotPole-Range",5] call Epoch_Message;
};
_nearestJammer = _nearjammers select 0;
if !((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID]) exitwith {
	["You are not in your PlotPole-Range",5] call Epoch_Message;
};
_OpenableItems = ["CinderWallGarage_EPOCH","WoodLargeWallDoorL_EPOCH","WoodLargeWallDoor_EPOCH","Land_BarGate_F","CinderWallDoorwHatch_EPOCH"];
_NearestDoors = [];
_fnc_CheckDoorsToOpen = {
	_NearestDoors = (nearestobjects [_nearestJammer,_OpenableItems,_buildingJammerRange]) select {
		([_x, "VIEW"] checkVisibility [eyePos player, [(getposasl _x select 0),(getposasl _x select 1),(getposasl _x select 2) + 1.5]]) > 0.5 && (
		_x animationPhase "open_left" < 0.5 &&
		_x animationPhase "open_right" < 0.5 &&
		_x animationPhase "Door_1_rot" < 0.5 &&
		_x animationPhase "Open_Door" < 0.5
		)
	};
	_NearestDoors
};
_fnc_CheckDoorsToClose = {
	_NearestDoors = (nearestobjects [_nearestJammer,_OpenableItems,_buildingJammerRange]) select {
		([_x, "VIEW"] checkVisibility [eyePos player, [(getposasl _x select 0),(getposasl _x select 1),(getposasl _x select 2) + 1.5]]) > 0.5 && (
		_x animationPhase "open_left" > 0.5 ||
		_x animationPhase "open_right" > 0.5 ||
		_x animationPhase "Door_1_rot" > 0.5 ||
		_x animationPhase "Open_Door" > 0.5
		)
	};
	_NearestDoors
};
if (_open) then {
	_NearestDoors = call _fnc_CheckDoorsToOpen;
}
else {
	_NearestDoors = call _fnc_CheckDoorsToClose;
};
if (_NearestDoors isequalto []) exitwith {
	[format ["No Door to %1 found",if (_open) then {"open"} else {"close"}],5] call Epoch_Message;
};
_DoorToHandle = _NearestDoors select 0; 
_value = (if (_open) then {1} else {0});
_DoorToHandle animate ['open_left', _value];
_DoorToHandle animate ['open_right', _value];
_DoorToHandle animate ['Door_1_rot', _value];
_DoorToHandle animate ['Open_Door', _value];

 

Link to comment
Share on other sites

@Tarabas

You will need to add this to CfgActionMenuCore.hpp
 

dyna_AtHome = "call {_config = 'CfgEpochClient' call EPOCH_returnConfig;_buildingJammerRange = getNumber(_config >> 'buildingJammerRange');_nearjammers = nearestobjects [player,['Plotpole_EPOCH'],_buildingJammerRange];if (_nearjammers isEqualTo []) exitwith {false};_nearestJammer = _nearjammers select 0;((_nearestJammer getVariable['BUILD_OWNER', '-1']) in[getPlayerUID player, Epoch_my_GroupUID])}";

He recently added that line into Epoch experimental here:
https://github.com/EpochModTeam/Epoch/compare/1e8a428d3c26...2fe4b0ff969e#diff-fd142c19fa4ee8fc1dbfbbb6bc8411c6R52

And thats whats needed in both "conditions" in here:
https://github.com/Ignatz-HeMan/Door-Opener/blob/master/CfgActionMenu_self.hpp#L3

Link to comment
Share on other sites

  On 3/11/2018 at 3:49 PM, DirtySanchez said:

@Tarabas

You will need to add this to CfgActionMenuCore.hpp
 

dyna_AtHome = "call {_config = 'CfgEpochClient' call EPOCH_returnConfig;_buildingJammerRange = getNumber(_config >> 'buildingJammerRange');_nearjammers = nearestobjects [player,['Plotpole_EPOCH'],_buildingJammerRange];if (_nearjammers isEqualTo []) exitwith {false};_nearestJammer = _nearjammers select 0;((_nearestJammer getVariable['BUILD_OWNER', '-1']) in[getPlayerUID player, Epoch_my_GroupUID])}";


Sorry bud, i think he forgot to add this into his repo:
https://github.com/EpochModTeam/Epoch/compare/1e8a428d3c26...2fe4b0ff969e#diff-fd142c19fa4ee8fc1dbfbbb6bc8411c6R52

Expand  

Oh.. yes, that makes sence.. and was missing.. thank you

now the last missing variable is dyna_IsDriver to make it work I think. right ?

Link to comment
Share on other sites

Correct.
these Variables will be included in 1.1, so I have only made a link to it in my repo (in readme)

 

Autmatic Door Opener

Install:

copy the files from epoch.mission into your mission file (if init.sqf already exist, paste the code into this file)
Add the following lines from CfgActionMenu_self.hpp into this file: "epoch.mission\epoch_config\Configs\CfgActionMenu\CfgActionMenu_self.hpp"
Configure the settings in "epoch.mission\addons\Ignatz_Client_DoorOpener.sqf"

Only for EPOCH 1.0:
Add this: https://github.com/EpochModTeam/Epoch/commit/2fe4b0ff969ea468cd5600fb86becee215eca5a0  <-------------------------------------------

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...