b3lx 161 Posted May 2, 2020 (edited) I have a weird problem where after hiding a massive number of map objects with hideobjectgobal through a preinit script they become unhidden after some minutes into the game. It happens when there is a high load like many spawned groups. Anybody has a clue? Edited May 3, 2020 by b3lx Share this post Link to post Share on other sites
Dedmen 2593 Posted May 7, 2020 Map objects are streamed in/out dynamically. I can imagine that when they are streamed out they forget that they have been hidden. And when then streamed back in, they show up. Also hideObjectGlobal for map objects? map objects are local-ish. 1 Share this post Link to post Share on other sites
b3lx 161 Posted May 7, 2020 5 hours ago, Dedmen said: they forget that they have been hidden. I think this is what is happening but look, I solved it by accident trying to debug it, no joke: _DEBUG_ON = false; [_DYA_HIDDENARRAY] spawn { while {true} do { sleep 20; if _DEBUG_ON then { _test = 0; _test = count (_DYA_HIDDENARRAY select {!(isObjectHidden _x)}); hint format ["time: %1, unhidden: %2",time, _test]; }; }; }; I thought you need to run hideobjectglobal in the server to be multiplayer compatible Share this post Link to post Share on other sites
Harzach 2507 Posted May 7, 2020 21 minutes ago, b3lx said: I thought you need to run hideobjectglobal in the server to be multiplayer compatible For mission objects, sure. Map objects are different. That's why the Hide Terrain Objects module has an "Operate Locally" checkbox. Share this post Link to post Share on other sites
b3lx 161 Posted May 7, 2020 1 minute ago, Harzach said: For mission objects, sure. Map objects are different. Ok, thanks, I missed that in the stuff I read. I'm going to change it. Should I keep the "if (isserver) then {...}" to make it possible to use in multiplayer or every client has to run it? Share this post Link to post Share on other sites
Harzach 2507 Posted May 7, 2020 It needs to run on every client. How to accomplish that might depend upon where you are running the code from, and maybe even the contents of the code itself. 1 1 Share this post Link to post Share on other sites
Dedmen 2593 Posted May 8, 2020 13 hours ago, b3lx said: no joke: Sure about that? 13 hours ago, b3lx said: if _DEBUG_ON then { Undefined variable. Error. Script does nothing. 13 hours ago, b3lx said: _DYA_HIDDENARRAY select Another undefined variable. Share this post Link to post Share on other sites
killzone_kid 1326 Posted May 8, 2020 35 minutes ago, Dedmen said: Undefined variable. Error. Script does nothing. Now defined and false, still script does nothing Share this post Link to post Share on other sites
Dedmen 2593 Posted May 8, 2020 3 minutes ago, killzone_kid said: Now defined and false Huh what where? I mean the script above, its a local variable and doesn't carry over into the spawn Share this post Link to post Share on other sites
b3lx 161 Posted May 8, 2020 2 hours ago, Dedmen said: Sure about that? Undefined variable. Error. Script does nothing. Another undefined variable. Here you have. This is the script I use. Those variables are actually global, by bad. Anyway it works with debug off so the only thing it does is to spawn an empty 20 seconds loop _center = [worldsize/2,worldsize/2]; _radius = worldsize; //for debug b3lx_DYA_HIDDEN_DEBUG = []; b3lx_DYA_HIDDEN_DEBUG_ON = false; ///////////////////FUNCTIONS _removeArrFNC = { _arr = _this; { hideObjectGlobal _x; b3lx_DYA_HIDDEN_DEBUG pushback _x; } forEach _arr; }; _rplModelFNC = { params ["_array","_oldList","_newlist"]; { _obj = _x; if ((getModelInfo _obj select 0) in _oldlist) then { _pos = getposATL _obj; _dir = getdir _obj; hideobjectglobal _obj; b3lx_DYA_HIDDEN_DEBUG pushback _x; _obj allowdamage false; _type = selectRandom _newlist; _new = _type createvehicle [0,0,0]; _new setdir _dir; if (_type == "b3lx_palm_B") then { _pos = _pos getpos [2.2,180+_dir]; }; _new setposATL _pos; }; } forEach _array; }; _removeModelFNC = { params ["_array","_oldlist"]; { _obj = _x; if ((getModelInfo _obj select 0) in _oldlist) then { hideobjectglobal _obj; b3lx_DYA_HIDDEN_DEBUG pushback _x; _obj allowdamage false; }; } forEach _array; }; _rplFNC = { params ["_array","_newobjarray"]; { _pos = getposATL _x; _dir = getdir _x; hideobjectglobal _x; b3lx_DYA_HIDDEN_DEBUG pushback _x; _x allowdamage false; _type = selectRandom _newobjarray; _new = _type createvehicle [0,0,0]; _new setdir _dir; if (_type == "b3lx_palm_B") then { _pos = _pos getpos [2.2,180+_dir]; }; _new setposATL _pos ; } forEach _array; }; ///////////////////GETDATA _trees = nearestTerrainObjects [_center, ["tree","small tree","bush"], _radius]; _all = nearestTerrainObjects [_center, [], _radius]; _houses = nearestTerrainObjects [_center, ["house"], _radius]; //_bushes = nearestTerrainObjects [_center, ["bush"], _radius]; //_other = (nearestTerrainObjects [_center, [], _radius]) - (_trees + _bushes + _houses); ///////////////////REMOVE BUSHES //_bushes call _removeArrFNC; ///////////////////REMOVE BAD MODEL BUSHES AND UNWANTED TREES _bushesToRemove = ["cype_brg_bird_1.p3d", "cype_brg_bird_3.p3d", "b_pistacial1s_ep1.p3d", "b_amygdalusn1s_ep1.p3d", "b_pinusm1s_ep1.p3d"]; _palmsToRemove = [ "cype_palm.p3d", "cype_palm_01.p3d", "cype_palm_02.p3d", "cype_palm_03.p3d", "cype_palm_04.p3d", "cype_palm_09.p3d", "cype_palm_10.p3d", "cype_palm_08small.p3d", "t_cacao_ripe_f.p3d", "t_cocosnucifera2s_small_f.p3d", "t_cocos_small_f.p3d", "t_cocos_tall_f.p3d" ]; _removetrees = _all select {(getModelInfo _x select 0) in (_bushesToRemove + _palmsToRemove)}; _removetrees call _removeArrFNC; ///////////////////REPLACE TREES _treesToReplace = ["t_cocosnucifera3s_tall_f.p3d","t_millettia_f.p3d","cype_amygdalus.p3d","t_ficusb1s_f.p3d","t_ficusb2s_f.p3d"]; _replacetrees = _trees select {(getModelInfo _x select 0) in _treesToReplace}; [_replacetrees, DYAtreesReplacers] call _rplFNC; //REPLACE TALL CUP RURAL BUILDINGS _CUPbldTall = [ "Land_House_K_8_EP1", "Land_House_K_8_dam_EP1", "Land_House_K_6_EP1", "Land_House_K_6_dam_EP1", "Land_House_K_3_EP1", "Land_House_K_3_dam_EP1", "Land_House_K_7_EP1", "Land_House_K_7_dam_EP1" ]; _housesRPL = _houses select {typeOf _x in _CUPbldTall}; [_housesRPL,DYAhousesReplacers] call _rplFNC; [b3lx_DYA_HIDDEN_DEBUG] spawn { while {true} do { sleep 20; if b3lx_DYA_HIDDEN_DEBUG_ON then { _test = 0; _test = count (b3lx_DYA_HIDDEN_DEBUG select {!(isObjectHidden _x)}); hint format ["time: %1, unhidden: %2",time, _test]; }; }; }; Share this post Link to post Share on other sites