Jump to content
anfo

hideObjectGlobal array syntax

Recommended Posts

Hi

 

May I request the syntax to show and hide multiple objects (array) using hideObjectGlobal please?

Share this post


Link to post
Share on other sites
{
 _x hideObjectGlobal _state;
}count _yourArray;

setting state true will hide all objects in _yourArray. setting it to false will show em.

Share this post


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

{
 _x hideObjectGlobal _state;
}count _yourArray;

setting state true will hide all objects in _yourArray. setting it to false will show em.

 

So in real world terms, something like this?

{
 _x hideObjectGlobal true;
}count (object_1, object_2);

 

Share this post


Link to post
Share on other sites
10 minutes ago, anfo said:

 

So in real world terms, something like this?


{
 _x hideObjectGlobal true;
}count (object_1, object_2);

 

 

no, more like this:

{
 _x hideObjectGlobal true;
}count [object_1, object_2];

 

  • Like 1

Share this post


Link to post
Share on other sites

Oh, sorry of course. Thank you!

Share this post


Link to post
Share on other sites

Sorry @sarogahtyp, it didn't seem to work. I place the code into init.sqf, and even tried _x hideObject true;

Here's my code. Likely I've messed up:

{
_x hideObjectGlobal true;
}count [bag_1, bag_2, bag_3, bag_4, bag_5, bag_6, bag_7, bag_8, bag_9, bag_10, bag_11, bag_12, bag_13, bag_14, bag_15, bag_16, bag_17, bag_18, bag_19, bag_20, bag_21, bag_22, bag_23, bag_24, zu3_3, zu3_8, zu3_7, zu3_6, zu3_5, zu3_4];

 

Share this post


Link to post
Share on other sites
2 minutes ago, anfo said:

Sorry @sarogahtyp, it didn't seem to work. I place the code into init.sqf, and even tried _x hideObject true;

Here's my code. Likely I've messed up:


{
_x hideObjectGlobal true;
}count [bag_1, bag_2, bag_3, bag_4, bag_5, bag_6, bag_7, bag_8, bag_9, bag_10, bag_11, bag_12, bag_13, bag_14, bag_15, bag_16, bag_17, bag_18, bag_19, bag_20, bag_21, bag_22, bag_23, bag_24, zu3_3, zu3_8, zu3_7, zu3_6, zu3_5, zu3_4];

 

 

any errors in .rpt file?

Share this post


Link to post
Share on other sites
50 minutes ago, sarogahtyp said:

 

any errors in .rpt file?

 

Not that I can see. But I did a simple vanilla test and your code surely works. Some trial and error testing required it appears.

 

edit: some other offender in init.sqf causing it to fail. Not sure what. Anyway, working as long as code at the tippy-top of init.sqf 😊

Share this post


Link to post
Share on other sites

Do not execute Global commands (such as hideObjectGlobal) on all clients. The init.sqf is execute by all players, (dedicated) server, headless client(s0, etc. When you use the global version of an engine command the information is communicated over the network to each connected entity by each connected entity. Causing a lot of network traffic.

 

In case of hideObjectGlobal it can only be executed by the server. So you need to move the code from your init.sqf to the iniServer.sqf file in you mission root. If you do not have a initServer.sqf in your mission root then simply create one.

Alternatively you can let the server execute the code in your init.sqf:

if isServer then { };

Your code would then look something like:

if isServer then {
	{
		_x hideObjectGlobal true;
	} count [bag_1, bag_2, bag_3, bag_4, bag_5, bag_6, bag_7, bag_8, bag_9, bag_10, bag_11, bag_12, bag_13, bag_14, bag_15, bag_16, bag_17, bag_18, bag_19, bag_20, bag_21, bag_22, bag_23, bag_24, zu3_3, zu3_8, zu3_7, zu3_6, zu3_5, zu3_4];
};

 

  • Like 3

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

×