Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Recommended Posts

Hi, everyone! I am looking for a script to lock all doors of the buildings around at a certain area? So, there could be a marker or trigger, which shows the location, where all doors should be set to locked. The main idea is, that these are not buildings placed down in the editor, otherwise I would not have any problems with that, but buildings that are already existing on a map. I think that the Game Logic module should be placed down as well, but what else should I do to make this work for me? Thank you in advance! 🙂

Share this post


Link to post
Share on other sites

I didn't find my answer in the list, but I am sure I've seen such a script for locking all doors at certain area, which should be marked by a marker or a present triggere - something I also can't remember. Would anyone help me with this issue? 🙂

Share this post


Link to post
Share on other sites

Maybe this works:

 

1) create a init.sqf and a fnc.sqf

 

2) type in init.sqf:

[] execVm “fnc.sqf“;

 

3) type in fnc.sqf:

fnc_lock_doors =

{

_pos = _this select 0;
_range = _this select 1;


_houses = nearestObjects [_pos, ["house"], _range];

 

{_x setVariable  [“BIS_Disabled_Door_1“,1,true]} foreach _houses;

{ _x setVariable  [“BIS_Disabled_Door_2“,1,true]} foreach _houses;

{ _x setVariable  [“BIS_Disabled_Door_3“,1,true]} foreach _houses;

{ _x setVariable  [“BIS_Disabled_Door_4“,1,true]} foreach _houses;

 

//and so on..

};

 

4) Whenever you want to use the lock script use this:

 //[position,range] call fnc_lock_doors;\\

 

for example: 

[[100,200,0], 300] call fnc_lock_doors;

 

 

Maybe it works, idk.. had no time to test it

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you, everyone!

The easiest and fastest way is this:

 

You can do it with a module from within the editor. Systems > Modules > Environment > Edit Terrain Object. Just place it on the building (building should show with purple box) open the modules attributes and door open/closing/locking is all in there. Unless this is something your trying to do at runtime after some condition as the module does not seem to support being tied to a trigger.

Cheers!

🙂

Edited by Dedmen
Removed all-bold. Rule 12
  • Like 3

Share this post


Link to post
Share on other sites

But if you want to close all doors in a bigger area, the script i gave you is much better 🙂 Place 100 modules and set them up, why not 🙂

  • Like 1

Share this post


Link to post
Share on other sites
55 minutes ago, Smart Games said:

But if you want to close all doors in a bigger area, the script i gave you is much better 🙂 Place 100 modules and set them up, why not 🙂

i believe you can change the radius in the modules. But not sure. 

Share this post


Link to post
Share on other sites
1 hour ago, Smart Games said:

But if you want to close all doors in a bigger area, the script i gave you is much better 🙂 Place 100 modules and set them up, why not 🙂

I actually did that. There were about 25 modules... 🙂 I was patient enough, don't worry. And still, when I have time, I will test your way, too! 🙂 Thank you!

  • Haha 1

Share this post


Link to post
Share on other sites

×