Jump to content
RafaDombras

[SOLVED] Help to hide flying tree

Recommended Posts

Hi!

 

Need help to hide a flying tree on the map, it's a bug:

 

cWLScgp.png

 

It's not detect with nearestTerrainObject and nearestObject

 

It works with cursorObject, identifies:     30580: i44_tree_decid_3.p3d 

 

the sentence "cursorObject hideObjectGlobal true; " works,

 

but: "30580: i44_tree_decid_3.p3d hideObjectGlobal true ; " doesn't work.

 

I tried  use quotes, use only the ID number, and nothing works,

 

How can I do it?

 

 

 

Share this post


Link to post
Share on other sites

Use the Hide Terrain Objects module? You also might want to report it to whoever created the terrain.

  • Like 1

Share this post


Link to post
Share on other sites

There must be a correctly way to write the sentence, that works:

 

30580: i44_tree_decid_3.p3d hideObjectGlobal true; 

I know the number is de Eden editor ID, but didn't work typing the number only...

 

If I use this module, the map will work to anyone that doesn't have it installed?

I rather to discover how to do it first, someone might had sofer this issue.

 

I need a way to store this object correctly in a variable, with this information I gave.

 

The map is "Operation Crossing Point" extension ".I44_merderet.koth" from IFA maps. How can I report it?

 

The biggest problem here, is it's not detectable by any trigger, I only could do it with "cursorObject".

 

What to do now? 🤦‍♂️

Share this post


Link to post
Share on other sites
39 minutes ago, RafaDombras said:

How can I report it?

 

Join their Discord and report there:  discord.gg/0vQjglomrhMXqTF1

 

Or post a detailed report in the IFA topic, I believe .kju helmed the original port of the I44 maps.

Discord is probably the better option.

 

44 minutes ago, RafaDombras said:

If I use this module, the map will work to anyone that doesn't have it installed?

 

Not sure what you mean. If you use this module in a mission you create/edit, then it will work for everyone, yes.

  • Like 2

Share this post


Link to post
Share on other sites

module not needed.

For SP/MP,  just add a logic (F5 logic entities  game logic) (or a trigger but there is no reason to check a condition each 0.5 sec.):

 

in init field: {_x hideObject true} forEach (nearestTerrainObjects [this, ["Tree"], 20]);

 

Set your radius.

You don't need to use the global command (hideObjectGlobal) on a "server only" code, because there is no need to broadcast something for nut. You just want that any PC runs this at start.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Ok, it seems very easy, but since it's not being detected by nearestTerrainObjects, only cursorObject detects it, how can I do?

 

Why cursorObject does not detect? Maybe because it's flying? Oh god.... 😂

 

Thanks!

Share this post


Link to post
Share on other sites

Are you sure? Did you try it? I took time and succeeded in hiding IFA3_AIO_lite Merderet trees. So...

If you need more help give map (3 different Merderet) and position.

Share this post


Link to post
Share on other sites

Now it works, I tried from many different distances and radius, then the crazy flying tree finally appears 😆

 

So I found its place on the array and used the position where the magic happens:

 

	// ============  Removes a flying tree on "Operation Crossing Point" map  ==============
	(nearestTerrainObjects [[3337.4,3689.55,0.00149918],[],15] select 1) hideObjectGlobal true; 

Now I can finish my mission,

 

Tanks a lot!

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm not sure if terrain object IDs are constant or not (I think they are).
If they are, all you have to do is write:

([3337.4,3689.55,0.00149918] nearestObject 30580) hideObjectGlobal true;

It will always return object ID 30580, but your method might return some other object (due to randomness).

  • Like 1

Share this post


Link to post
Share on other sites
On 8/24/2020 at 2:44 PM, pierremgi said:

module not needed.

For SP/MP,  just add a logic (F5 logic entities  game logic) (or a trigger but there is no reason to check a condition each 0.5 sec.):

 

in init field: {_x hideObject true} forEach (nearestTerrainObjects [this, ["Tree"], 20]);

 

Set your radius.

You don't need to use the global command (hideObjectGlobal) on a "server only" code, because there is no need to broadcast something for nut. You just want that any PC runs this at start.

 

 

All you have done is hacked together an object that does what the module does.

 

I don't understand why people are resistant to the solution BI has provided for our convenience.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Harzach said:

 

All you have done is hacked together an object that does what the module does.

 

I don't understand why people are resistant to the solution BI has provided for our convenience.

 

This module is convoluted for nuts. The "operate locally" option should be the normal code (not an option). In what case, is it preferable to use the hideObjectGlobal command from server?... none.

It's up to you to prefer a module with a hundred line function rather than a simple logic with a command line. For a tree? Why, filter ["TREE","SMALL TREE","BUSH"] when ["TREE"] is enough?

{_x hideObject true} forEach (nearestTerrainObjects [this, ["Tree"], 20]);

or
 

Spoiler

 

#define MAP_TYPES_BUILDING            ["BUILDING","HOUSE","CHURCH","CHAPEL","FUELSTATION","HOSPITAL","RUIN","BUNKER"]
#define MAP_TYPES_VEGETATION        ["TREE","SMALL TREE","BUSH"]
#define MAP_TYPES_WALL                ["WALL","FENCE"]
#define MAP_TYPES_MISC                ["ROCK","ROCKS","FOREST BORDER","FOREST TRIANGLE","FOREST SQUARE","CROSS","FORTRESS","FOUNTAIN","VIEW-TOWER","LIGHTHOUSE","QUAY","HIDE","BUSSTOP","ROAD","FOREST","TRANSMITTER","STACK","TOURISM","WATERTOWER","TRACK","MAIN ROAD","POWER LINES","RAILWAY","POWERSOLAR","POWERWAVE","POWERWIND","SHIPWRECK","TRAIL"]

#define CATEGORY_COMP                [MAP_TYPES_BUILDING,MAP_TYPES_WALL,MAP_TYPES_VEGETATION,MAP_TYPES_MISC]

//["[ ] %1",_this] call bis_fnc_logFormat;

private _mode = param [0,"",[""]];
private _input = param [1,[],[[]]];
private _module = _input param [0,objNull,[objNull]];

switch _mode do
{
    // Default object init
    case "init":
    {
        if (is3DEN) exitWith {};

        //local hiding is applicable only in MP where checkbox is ticked
        private _hideLocaly = (_module getVariable ["#hideLocally",false]) && isMultiplayer;

        //filter flags
        private _value = _module getVariable ["#filter",0];

        if (_hideLocaly) then
        {
            //hide locally on each client; cannot delete the module
            ["hide",[_module,_hideLocaly,_value]] remoteExecCall ["bis_fnc_moduleHideTerrainObjects",0,true];
        }
        else
        {
            //hide globally on server
            ["hide",[_module,_hideLocaly,_value]] call bis_fnc_moduleHideTerrainObjects;

            //delete module
            deleteVehicle _module;
        };
    };
    //[_mode,[_module,_hideLocaly]] call bis_fnc_moduleHideTerrainObjects;
    case "hide":
    {
        //local hiding is applicable only in MP where checkbox is ticked
        private _hideLocaly = _input param [1,false,[true]];
        private _value = _input param [2,0,[123]];

        //get the data
        private _area = [getPos _module];
        _area append (_module getVariable ["objectarea",[]]);
        _area params ["_pivot","_a","_b"];

        private _radius = (_a max _b) * 1.42;
        private _objects = [];

        //get objects to hide
        private _flags = _value call bis_fnc_decodeFlags2;

        //prepare hiding code
        private _hidingCode = switch (true) do
        {
            case (_hideLocaly && isServer):
            {
                {_x hideObject true;_x allowDamage false;};
            };
            case (_hideLocaly && !isServer):
            {
                {_x hideObject true;};
            };
            default
            {
                {_x hideObjectGlobal true;_x allowDamage false;};
            };
        };

        {
            if (_x == 1) then
            {
                private _found = nearestTerrainObjects [_module,CATEGORY_COMP select _forEachIndex,_radius,false,true];

                _hidingCode forEach (_found inAreaArray _area);
            };
        }
        forEach _flags;
    };

    // When some attributes were changed (including position and rotation)
    case "attributesChanged3DEN":
    {
        //get module info
        private _size = (_module get3DENAttribute "Size3") select 0;
        private _isRectangle = (_module get3DENAttribute "isRectangle") select 0;

        //exit if module is deleted during dragging; _size & _isRectangle become nil at that point
        if (isNil{_size} || {isNil{_isRectangle}}) exitWith {};

        _size params ["_a","_b"];

        private _radius = (_a max _b) * 1.42;
        private _objects = [];
        private _area = [getPos _module, _a, _b, getDir _module, _isRectangle, -1];

        private _value = (_module get3DENAttribute "#filter") select 0;

        private _flags = _value call bis_fnc_decodeFlags2;

        //get counts per category
        private _counts = _module getVariable ["#counts",[]];

        for "_i" from 0 to 3 do
        {
            private _state = _flags param [_i,0];

            //get objects in the area and category
            private _found = nearestTerrainObjects [_module,CATEGORY_COMP select _i,_radius,false,true];
            _found = _found inAreaArray _area;

            //update count for given category
            _counts set [_i,count _found];

            //collect the objects
            if (_state == 1) then {_objects append _found};
        };

        //unhide previously hidden object
        {_x hideObject false;} forEach (_module getVariable ["#objects",[]]);

        //store objects that will be hidden and hide them
        _module setVariable ["#objects",_objects];
        _module setVariable ["#counts",_counts];

        //hide all objects on map
        {
            private _objects = _x getVariable ["#objects",[]];

            {_x hideObject true} forEach _objects;
        }
        forEach ((all3DENEntities select 3) select {typeOf _x == "ModuleHideTerrainObjects_F"});
    };
    // When added to the world (e.g., after undoing and redoing creation)
    case "registeredToWorld3DEN":
    {


    };
    // When removed from the world (i.e., by deletion or undoing creation)
    case "unregisteredFromWorld3DEN":
    {
        //module is removed, show all hidden objects
        {_x hideObject false} forEach (_module getVariable ["#objects",[]]);
    };
    // When connection to object changes (i.e., new one is added or existing one removed)
    case "connectionChanged3DEN":
    {


    };

    case "objectTypeFilter_attributeLoad":
    {
        private _ctrlAttribute = _input param [1,controlNull,[controlNull]];
        private _value = _input param [2,1,[123]];

        private _ctrlCheckboxes = _ctrlAttribute controlsGroupCtrl 100;
        private _flags = _value call bis_fnc_decodeFlags2;

        for "_i" from 0 to 3 do
        {
            private _state= _flags param [_i,0];

            if (_state == 1) then
            {
                private _ctrlCheckbox = _ctrlCheckboxes controlsGroupCtrl (101+_i);
                _ctrlCheckbox cbSetChecked true;
            };

            private _count = (_module getVariable ["#counts",0]) select _i;

            if (_count > 0) then
            {
                private _ctrlText = _ctrlCheckboxes controlsGroupCtrl (121+_i);
                _ctrlText ctrlSetText str _count;
                _ctrlText ctrlSetTextColor [1, 0.56, 0, 1];
                _ctrlText ctrlSetTooltip format[localize "STR_a3_to_hideTerrainObjects5",_count];
            };
        };
    };
    case "objectTypeFilter_attributeSave":
    {
        private _ctrlAttribute = _input param [1,controlNull,[controlNull]];
        private _ctrlCheckboxes = _ctrlAttribute controlsGroupCtrl 100;
        private _flags = [];
        private _value = 0;

        for "_idc" from 101 to 104 do
        {
            if (cbChecked(_ctrlCheckboxes controlsGroupCtrl _idc)) then
            {
                _flags pushBack 1;
            }
            else
            {
                _flags pushBack 0;
            };
        };

        _value = _flags call bis_fnc_encodeFlags2;

        _value
    };
};

 

 

for the same result...

 

Such modules are for people who don't want to script. If you dig into the BI functions (here the BIS_fnc_moduleHideTerrainObjects), you can save so much lines of code!

 

6 hours ago, Leopard20 said:

I'm not sure if terrain object IDs are constant or not (I think they are).
If they are, all you have to do is write:


([3337.4,3689.55,0.00149918] nearestObject 30580) hideObjectGlobal true;

It will always return object ID 30580, but your method might return some other object (due to randomness).

 

Don't use the hideObjectGlobal command without any code for server only (that's mandatory).
So, in this case, no added value in regard of hideObject when you run it everywhere.
 

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, pierremgi said:

Don't use the hideObjectGlobal command without any code for server only (that's mandatory).
So, in this case, no added value in regard of hideObject when you run it everywhere.

I was just quoting the guy. So I didn't pay much attention to that. But you're right about that one.

Share this post


Link to post
Share on other sites
On 8/26/2020 at 7:06 PM, Leopard20 said:

I'm not sure if terrain object IDs are constant or not (I think they are).
If they are, all you have to do is write:


([3337.4,3689.55,0.00149918] nearestObject 30580) hideObjectGlobal true;

It will always return object ID 30580, but your method might return some other object (due to randomness).

This I didn't know, but the main problem is it wasn't being detected by near objects, and now I found lots of other trees flying, so I think it's better to report to the map maker.

  • Like 1

Share this post


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

This I didn't know, but the main problem is it wasn't being detected by near objects, and now I found lots of other trees flying, so I think it's better to report to the map maker.

Yes, IFA3 is still in development, so hopefully it will get fixed.

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

×