Home   Help Search Login Register  

Author Topic: Close doors  (Read 4239 times)

0 Members and 1 Guest are viewing this topic.

Offline nightflyer23

  • Members
  • *
Close doors
« on: 30 Jun 2009, 15:02:17 »
Hi this is my first post here ;)

My question is how to close doors in buildings from the mission start on ???
On the Normal map all doors in every building is open or if you add one doors also open.
My idia is to close some doors and hide some units inside,so whats the command for that ??
and if there one can i close doors from buildings there allready on the map,like this bg church or so on ??

excuse my bad english ;)

i hope someone could answear me.

Offline mr_book.PXS.Pvt

  • Members
  • *
Re: Close doors
« Reply #1 on: 16 May 2011, 07:52:35 »
Huh,
I see, this is an old one. So what, I'm gonna reply anyway.
Closing doors, well, that's not an easy one, thanks to BIS. I mean, basically, all you need is this:
Code: [Select]
_houses = [1000,1000] nearobjects ["house", 1000000];
{
 _x animate ["door", 0];
 sleep 0.0001;
} foreach _houses;
Or so you think! Problem: BIS forgot to use a standard or nomenclature for their buildings. So, some doors are named "door", some are named "dvere", then we have "door01" or "door_01" and so on. It's a mess!
And it gets even worse! On ArmA 2 buildings, the parameter to close a door is 0, while on OA buildings, the parameter is 1! Dear BIS, how can you possibly confuse 0s and 1s?!?
Whatever! So, after a long period of trying, this came out:
Code: [Select]
_houses = [1000,1000] nearObjects ["house", 1000000];
_zeroes = ["dvere","dvere1l","dvere1r","dvere2l","dvere2r","dvere_spodni_r","dvere_spodni_l","dvere_vrchni","vrata1","vrata2","vratal1","vratar1","vratal2","vratar2","vratal3","vratar3"];
_ones = ["door","door_1_1","door_1_2","door_2_1","door_2_2","dvere1","dvere2","dvere3","dvere4","dvere5","dvere6","dvere7","dvere8","dvere9","dvere10","dvere11","dvere12","dvere13","dvere14","doorl","doorr","door_01","door01_a","door_02","door02_a","door_03","door_04","door_05","door_06","door_1a","door_1","door_2"];
{
 _y = _x;
 {_y animate [format ["%1", _x], 0]} foreach _zeroes;
 {_y animate [format ["%1", _x], 1]} foreach _ones;
 sleep 0.0001;
} foreach _houses;
As far as I know, it works on most buildings. No, wait, I think forgot about the LHD. Ach, not that important, eh? If there's more missing, or not working at all, just let me know.
Good day,
mr_book

EDIT: I just found out that above script doesn't work on both Utes and Chernarus. A (rather unsatisfying) workaround is:
Code: [Select]
{
 _y = _x;
 {_y animate [format ["%1", _x], 0]} foreach _zeroes;
 if ((worldname=="Utes") or (worldname=="Chernarus")) then
 {
  {_y animate [format ["%1", _x], 0]} foreach _ones;
 } else
 {
  {_y animate [format ["%1", _x], 1]} foreach _ones;
 };
 sleep 0.0001;
} foreach _houses;
It does work now, although it looks really messed up. Take it or leave it, the choice is yours.
« Last Edit: 16 May 2011, 17:24:40 by mr_book.PXS.Pvt »