mcnools 62 Posted July 29, 2019 Hello, I'm making a mission on one of the Iron Front-terrains where I want to remove a bridge to replace it with another model, however, neither creating a game logic to remove nearestTerrainObjects nor using the hide terrain objects-module works. They remove all other objects in the area but not the bridge nor the road leading to the bridge (which leads me to the conclusion that the bridge counts as a road). I've tried searching for a way to hide roads but no luck, is it possible at all or am I screwed? 🙂 (to be specific it's the pontoon bridges on the baranow map, if anyone is curious, but I recall the same thing happening with other bridges/roads before). Share this post Link to post Share on other sites
Smart Games 76 Posted July 29, 2019 try: _roads = nearestTerrainObjects [myposition, ["Road"], 50]; {_x hideObject true} foreach _roads; or: _roads = nearestTerrainObjects [myposition, ["Main Road"], 50]; {_x hideObject true} foreach _roads; try to start it with the init.sqf or with a trigger good luck 1 Share this post Link to post Share on other sites
mcnools 62 Posted July 29, 2019 Not sure how to make it function correctly, I made an init.sqf with: _roads = nearestTerrainObjects [myposition, ["Road"], 500]; {_x hideObject true} foreach _roads; Then I made a mareker called "Road" on the map where the roads are to be removed, however, when I start I get this error message: "Error, undefined variable in expression: myposition". Is there any way to set it so that it deletes the roads around a specific marker? Tried creating a marker called "myposition" too but I get the same error. Share this post Link to post Share on other sites
Smart Games 76 Posted July 29, 2019 the variable myposition is undefined 🙂 for myposition you have to get the pos of your marker, like this: _roads = nearestTerrainObjects [(getmarkerpos “Road“) , ["Road"], 500]; or: _makerpos = getmarkerpos “Road“; _roads = nearestTerrainObjects [_markerpos , ["Road"], 500]; or go to the marker and take the coordinates of the marker (than you dont really need the marker any more). use this form: [x,y,z]. Example: _roads = nearestTerrainObjects [[1200,2403,0], ["Road"], 500]; The word “Road“ or “Main Road“ in the script is just like a filter. The script creates an array with a list of all “Roads“ or “Main Roads“ in the range. For Example: [“street1“, “street2“, “street3“]. To the syntax: _roads = nearestTerrainObjects [position, “filtertype“, radius]; Hope you understand this part now. To the second part: {_x hideObject true} foreach _roads; The _x is a “magic variable“. It takes every single Object from the array _roads and runs the script in the {} with that object. 2 Share this post Link to post Share on other sites
mcnools 62 Posted July 29, 2019 (edited) Thanks for explaining 🙂 will try it out tomorrow hopefully! EDIT: Well, I got the script to initiate without errors but no roads or bridges are dissapearing, I put this in the init.sqf: _roads = nearestTerrainObjects [[2221,2607,0], ["Road"], 500]; {_x hideObject true} foreach _roads; And also tried with "Main Road" instead of Road, no success. So, I found the bridge-object that you can place in the editor and checked it in the config viewer, looks like this: Tried to use "LIB_Objects_Pathway_Bridges_base instead of "Road" (long shot maybe..) but it didn't work either. Maybe it's possible to hide terrain objects with the objects classname maybe? (Land_WW2_Ponton_Bridge that is). Edited July 30, 2019 by mcnools 1 Share this post Link to post Share on other sites
Smart Games 76 Posted July 30, 2019 From the wiki: Possible type names:"TREE", "SMALL TREE", "BUSH", "BUILDING", "HOUSE", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "CHURCH", "CHAPEL", "CROSS", "BUNKER", "FORTRESS", "FOUNTAIN", "VIEW-TOWER", "LIGHTHOUSE", "QUAY", "FUELSTATION", "HOSPITAL", "FENCE", "WALL", "HIDE", "BUSSTOP", "ROAD", "FOREST", "TRANSMITTER", "STACK", "RUIN", "TOURISM", "WATERTOWER", "TRACK", "MAIN ROAD", "ROCK", "ROCKS", "POWER LINES", "RAILWAY", "POWERSOLAR", "POWERWAVE", "POWERWIND", "SHIPWRECK", "TRAIL" You could also try “house“ or “building“, saw both in your picture An other example from the wiki: nearestTerrainObjects [player, [], 50]; For you: _roads = nearestTerrainObjects [[2221,2607,0], [], 500]; {_x hideObject true} foreach _roads; This one returns EVERY object in the radius of 500 meters. Share this post Link to post Share on other sites
Smart Games 76 Posted July 30, 2019 My last idea: 1) Use the Edit Terrain Module from the Editor and give the bridge a name (for example: bridge1) 2) Go to your init.sqf: bridge1 setPosATL [getPosATL bridge1 select 0, getPosATL bridge1 select 1, (getPosATL bridge1 select 2)-100]; Share this post Link to post Share on other sites
mcnools 62 Posted July 30, 2019 Well, I tried _roads = nearestTerrainObjects [[2221,2607,0], [], 500]; {_x hideObject true} foreach _roads; But it removes all objects apart from the road and bridges, Edit Terrain Module doesn't "stick" to any of the bridges or road objects either so I guess they're classified in some othe way which makes them impossible to do anything about maybe. I really appreciate you helping out though! Share this post Link to post Share on other sites
Smart Games 76 Posted July 30, 2019 Not good 🙂 Found this in the web to remove all objects with the same classname: { if (_x typeOf "Bridge_Classname") then { deleteVehicle _x; }; } forEach nearestObjects [player, ["All"], 1000000]; Share this post Link to post Share on other sites
mcnools 62 Posted July 30, 2019 No luck 😞 (sorry if I'm doing something obvious wrong, I never really understood scripting) Share this post Link to post Share on other sites
Smart Games 76 Posted July 30, 2019 🙂 🙂 no idea { if (_x typeOf "Land_WW2_Ponton_Bridge") then { _x hideobject true}; } forEach nearestObjects [player, [], 1000000]; Maybe there is no (easy) way to do that Share this post Link to post Share on other sites
Dedmen 2588 Posted July 30, 2019 48 minutes ago, Smart Games said: no idea Reading the wiki helps. https://community.bistudio.com/wiki/typeOf See example 1. 1 Share this post Link to post Share on other sites
Tankbuster 1733 Posted July 30, 2019 Roads aren't terrainobjects. Look at the nearroads command Share this post Link to post Share on other sites