Open/Close Doors issue with: Classname: Land_MBG_Police_Station

UrbanSkaters

Valued Member!
Edit: I'm running Epoch Origins Lingor . I saw another post that mentioned the issue might be related to Epoch!

Earlier today I noticed that if as an admin I pressed key 1 (which is unlock vehicle) inside a Land_MBG_Police_Station, I would get the option to open and close all the doors that were once considered by myself and other players as just static (the option to open/close doors wasn't available unless i used the admin key). I also notice this works with the big brown boat houses (Lingor Island). So my questions is this:

Why does this piece of code below give the player the option to open/close doors for those particular buildings, and only when using this bit of code? Does anyone know a way to make those doors active without having to use this?

Code:
{player reveal _x;} forEach (player nearObjects ['Land_MBG_Police_Station',25]); //This gives the player open/close options, but not without it?

I know what the reveal command does, I'm just confused as to why the object needs to be revealed to the player before they get open/close options lol, and whether there's a way to make this default without using the above code. :)
 
Last edited:
Just guessing here. If you are not looking at an object (cursortarget) then your character has no information that the object even exists, so the reveal provides the information to your player even though that object is out of view. So that is notifying your player that these objects exist? or ... who knows the mysteries of Arma.
If its just the script running thats required then ...
You can run that script at player join in the mission init.sqf changing it to

{player reveal _x;} forEach ((getmarkerpos "center") nearObjects ['Land_MBG_Police_Station',7500]);

that should reveal all the buildings to the player.
Alternatively you could run a script that checks the buildings within distance every few seconds

while {isalive player} do {
sleep 30;
{player reveal _x;} forEach (player nearObjects ['Land_MBG_Police_Station',200]);
};
 
Yeah at the moment I use the while loop but it just feels too duct-tape'y to me , if you know what I mean. The building is definitely being picked up by the cursor , I've got a debug that shows anything I'm looking at and even without admin tools it shows the building name.

Good old Arma logic at its best :D
 
Just guessing here. If you are not looking at an object (cursortarget) then your character has no information that the object even exists, so the reveal provides the information to your player even though that object is out of view. So that is notifying your player that these objects exist? or ... who knows the mysteries of Arma.
If its just the script running thats required then ...
You can run that script at player join in the mission init.sqf changing it to

{player reveal _x;} forEach ((getmarkerpos "center") nearObjects ['Land_MBG_Police_Station',7500]);

that should reveal all the buildings to the player.
Alternatively you could run a script that checks the buildings within distance every few seconds

while {isalive player} do {
sleep 30;
{player reveal _x;} forEach (player nearObjects ['Land_MBG_Police_Station',200]);
};

I have this problem too.

How would I use the code you've provided?

Do I have to create an sqf file and call it from the init?

Thank you.
 
It looks like this is a bug with those particular buildings, since they are custom made for Lingor:
https://forums.bistudio.com/topic/171612-replace-building-finding-the-correct-position/

@Hux you can just place this at the bottom of init.sqf and it will run on all players when they load in.
Code:
{player reveal _x;} count ((getMarkerPos "center") nearObjects ["Land_MBG_Police_Station",7500]);

Thank you.

I also had the same problem with the hangers at the airfields.

How would I add another class name of building to that line of code?
 
I put: {player reveal _x;} count ((getMarkerPos "center") nearObjects ["Land_MBG_Police_Station",7500]);
at the bottom of my init but it's not working for me. I still can't open the doors.
 
erros in your client or server rpt logs?

I didn't see any errors using the line: {player reveal _x;} count ((getMarkerPos "center") nearObjects ["Land_MBG_Police_Station",7500]);

I also tried making an sqf file with the code:

while {isalive player} do {
sleep 30;
{player reveal _x;} forEach (player nearObjects ['Land_MBG_Police_Station',200]);
};

I called it from the init with this: [] execVM "opendoors.sqf"; (file name opendoors.sqf)

With that I got this error in my rpt:

22:57:30 Error in expression <ingor\opendoors.sqf"

while {isalive player} do {
sleep 30;
{player reveal _x>
22:57:30 Error position: <player} do {
sleep 30;
{player reveal _x>
22:57:30 Error Missing ;
22:57:30 File mpmissions\DayZ_Epoch_7.Lingor\opendoors.sqf, line 5
22:57:30 Error in expression <ingor\opendoors.sqf"
 
line 5 is missing semicolon at the end?
its,the block looping with the count, try rewriting it using a foreach
 
Last edited:
line 5 is missing semicolon at the end?
its,the block looping with the count, try rewriting it using a foreach

I'm using the code you provided above.

Code:
while {isalive player} do {
sleep 30;
{player reveal _x;} forEach (player nearObjects ['Land_MBG_Police_Station',200]);
};

How would I rewrite it?

Do you use this on your server?
 
no,i dont have a server. i made that up off the top of my head.
i thought i saw a post where ebay said to do this a single time in the init.sqf?

{player reveal _x;
}
forEach (player nearobjects ['Land_MBG_Police_Station',15000]);

that code wont work as written because nearobjects takes a position and we gave it a player. it should be position player. but a better way is this to use the center map location and search the entire map.

forEach ([7500,7500,0] nearobjects ['Land_MBG_Police_Station',7500]);

EDIT: yeah, thats exactly what ebay said about 6 posts up. with the getmarkerpos center. i always just use the actual center location of the map since i usually edit scripts in arma2 editor and dont have the dayz specific stuff.
but read ebays post
 
I tried your line: forEach ([7500,7500,0] nearobjects ['Land_MBG_Police_Station',7500]);

I had already tried ebay's version: {player reveal _x;} count ((getMarkerPos "center") nearObjects ["Land_MBG_Police_Station",7500]);

Neither one is working for me. I placed the code at the bottom of the init.sqf and I get no errors in my client or server rpt.
 
if there are no errors, then is the classname correct? why dont you,do some debugging?
whats the first question you should ask if there are no syntax errors?
answer: is nearObjects returning an array of the police stations?
so print the return value to the rpt log to see what it is. I would do this in the editor so you can check,for,something else or,experiment with the code until it works.
so start the editor (control e) and select lingor.
you have to create a center, group, and unit so you can preview the mission.
now create a trigger and set activation to radio alpha. the activation expression should be:

stations = ([7500,7500] nearobjects ['Land_MBG_Police_Station',7500]);
hint format["%1 stations found", count stations];

now preview and press 0 0 1 to activate radio alpha.

if that doesnt return expected,results you can edit,the code to,display what you want it too. place your unit near one and see if the doors open.
 
Well I tried what you suggested and in the editor my hint message showed 23 police stations

I confirmed the class name but I still get nothing on server.
 
okay. so we know the nearestobjects is working anf lld the classname is coorrect.
i dont know what to tell you. do this is the editor using radio alpha trigger to execute a script. have the script output to the arma2oa.rpt,log (its in users appdata,local arma2oa folder) and to hint. if your code,is,working with a valod array, then it will either have a logic error where it doesnt work with no log errors, a syntax error where it will have log errors or it actually does work but not as expected.

post what you have and i will,try it out tonight for a moment.
 
Back
Top