Jump to content
TheoneandonlyNOR

AI open and close Bargate

Recommended Posts

Hello,

 

I wounder if this is possible?

 

more spesific:

I Have a Guarded AI next to the Bargate that has nothing else to do. So why not make him Open the Bargate for you when you enter the trigger? 

And ofc close it when trigger gets disabled/inactive. Or if I miss enter trigger and leave, the AI will not open it.

My unit got Variable Name "Unit1" and the Bargate "Gate1"

 

Regards. I tried to search for this, but can only find the auto open close with trigger. I don't want it.

Share this post


Link to post
Share on other sites

Well there is this thread here:

 

https://forums.bohemia.net/forums/topic/148623-openclose-bargate-solution/

 

but if you want a simple trigger based solution you can:

 

1.] Create two triggers.

2.] Set them to repeatable. Click on the trigger there is a box saying repeatable.

3.] In the first one add as a condition:

 

unit1 distance Gate1 <10;

 

and in the initialization field:

 

Gate1 animate ["Door_1_rot", 1];

 

4.] In the second trigger place a timeout of 2 seconds. Click on the trigger and place 2 where it asks for the time. You will have to place 2 three times in the three boxes.

5.] In the second trigger add as a condition:

 

unit1 distance Gate1 >10;

 

and in the initialization field:

 

Gate1 animate ["Door_1_rot", 0];

 

All done! Although I cannot understand why you do not want the loop solution but its your call :thumbsup:

 

  • Like 1

Share this post


Link to post
Share on other sites
On 4/30/2019 at 8:38 PM, JohnKalo said:

 

Well this didn't work for me. It looks like the Bargate from Curator DLC does not work with ( Gate1 animate ["Door_1_rot" 1/0] ). 

Thats why I wish the AI Unit to open it for me and close it. 🙂

I have not tested your solution Yet. Will try this now.

Share this post


Link to post
Share on other sites

Have now tested ure solution but it does not work. I belive the Curator DLC bargate (land_gm_euro_misc_bargate_01_closed) does not work. Reson I use "closed" Bargate is because the Bargate model cover only half of the road and opens sideways and the closed/open one covers the whole road and opens upwards.

Share this post


Link to post
Share on other sites

I managed it too work! But I had to use ["door_01", 1/0].

 

_nul = [this] spawn { while {true} do { waitUntil { sleep 1;

_entities = (getposATL (_this select 0)) nearEntities [["Car"],30];

_blueEntities = _entities select {side _x == "WEST"}; count _blueEntities > 0; }; (_this select 0) animate ["door_01", 1]; waitUntil { sleep 1;

_entities = (getposATL (_this select 0)) nearEntities [["Car"],30]; _blueEntities = _entities select {side _x == "WEST"}; count _blueEntities == 0; }; (_this select 0) animate ["door_01", 0]; }; };

 

Ty for the help!

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Maybe this is the starting point to a good use of "Papers please mod" (https://steamcommunity.com/sharedfiles/filedetails/?id=1249483448) It has a few interactions and functions:

Functions:

Spoiler

Functions:
----------------------------------------------------------------------------
Function: PapersPlease_fnc_documents

Description:
    Gets a list of all documents a unit has
 
Parameters:
    _unit - The unit to check [Unit]
    
Returns:
    List of documents the unit has [Array of strings]

Example:
    _documents = player call PapersPlease_fnc_documents;
    
    _allowEntry = ("PapersPlease_PermitEntry" in _documents);
----------------------------------------------------------------------------
Function: PapersPlease_fnc_giveDocument

Description:
    Forces the _unit to give _document to _target if possible
    
    *_unit and _target must be < 5m apart
    *_document must be in items _unit
 
Parameters:
    _target - The unit receiving the document [Unit]
    _unit - The unit giving the document [Unit]
    _document - Classname of the document [String]
    
Returns:
    Success [Boolean]

Example:
    [_unit, player, "PapersPlease_PermitEntry"] call PapersPlease_fnc_giveDocument
----------------------------------------------------------------------------
Function: PapersPlease_fnc_showDocument

Description:
    Forces the _unit to show _document to _target if possible
    
    *_unit and _target must be < 5m apart
    *_document must be in items _unit
 
Parameters:
    _target - The unit being show the document [Unit]
    _unit - The unit showing the document [Unit]
    _document - Classname of the document [String]
    
Returns:
    Success [Boolean]

Example:
    [_unit, player, "PapersPlease_PermitEntry"] call PapersPlease_fnc_showDocument
----------------------------------------------------------------------------

CBA Events:
----------------------------------------------------------------------------
Event Name: PapersPlease_shownDocument

Description:
    Thrown when a unit shows another unit papers successfully

Locality:
    Global

Arguments:
    _target - The unit being show the document [Unit]
    _unit - The unit showing the document [Unit]
    _document - Classname of the document [String]
----------------------------------------------------------------------------
Event Name: PapersPlease_givenDocument

Description:
    Thrown when a unit gives another unit papers successfully

Locality:
    Global

Arguments:
    _target - The unit being given the document [Unit]
    _unit - The unit giving the document [Unit]
    _document - Classname of the document [String]
----------------------------------------------------------------------------

 

Share this post


Link to post
Share on other sites

Dang, thought you meant the vanilla bargate. Glad you were able to fix the issue. Nicely done!

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

×