Ninja2dan

[SOLVED] Looking for "remove item" script

7 posts in this topic

I'm needing some kind of script or code that I can use to remove objects on the map at server load, such as curbs. I have been trying some code that works great in the editor, but fails to work on the live server.

For example, I can place the code below into the init of a battery, flagging the battery as s simple object and to not show the model. It then removes all curbs, bushes, trees, trash cans, or other objects (not buildings) within the radius called by the code.

Quote

{ hideObjectGlobal _x } forEach (( nearestObjects [ getPos this , [], 10 ]) - (( getPos this ) nearObjects 10 ));

When I preview the map in the editor with the batteries and init code in the mission.sqm, it works. The curbs are gone, without any "ghost" object to bump into. It's vital that this works due to my trader layout, but when I add those items and code into the mission.sqm for the server, those items are not removed.

I've already talked with a few very talented scripters, and so far they have not been able to provide a working solution. I have seen a few other servers that have curbs or other items removed on their maps, so I know it's possible. But so far nobody has been willing to share how to do it. I'm left with posting on the forums here and asking if anyone else either knows of an existing method that actually works, or is willing to create something that works. I'm on a fixed income, but I'm willing to compensate someone if necessary if they can make this happen.

Edited by Ninja2dan
solution provided

Share this post


Link to post
Share on other sites

this is what i use

Spoiler

/**
 * Remove/Hide Map Objects From Terrain
 */

_markerarray = ["RemoveMapObjects1","RemoveMapObjects2","RemoveMapObjects3"];

_location=[26726.8,24589.5,0];    
_radius=15;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

_location=[26808.3,24674.5,0];    
_radius=8;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

_location=[26762.8,24623.6,0];    
_radius=8;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

so just name it as a like Remove_Objects.sqf  as example and i made a folder called Remove_Objects and placed this into a customs folder    example

then call it from your init.sqf like this

[] execVM "Custom\Remove_Objects\Remove_Objects.sqf";

 

i hope this is what you need gl

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Advertisement
3 hours ago, hogansheroes said:

this is what i use

i hope this is what you need gl

So instead of placing something (object, logic, etc) at the center of where I need objects cleared, I just copy and paste their coord into that script. And I don't have an init.sqf, just the local/server files. Does that mean I need to create the init.sqf to place into the mission folder?

Share this post


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

So instead of placing something (object, logic, etc) at the center of where I need objects cleared, I just copy and paste their coord into that script. And I don't have an init.sqf, just the local/server files. Does that mean I need to create the init.sqf to place into the mission folder?

sent you a pm

Share this post


Link to post
Share on other sites
On 9/14/2018 at 8:04 AM, hogansheroes said:

this is what i use

  Hide contents

/**
 * Remove/Hide Map Objects From Terrain
 */

_markerarray = ["RemoveMapObjects1","RemoveMapObjects2","RemoveMapObjects3"];

_location=[26726.8,24589.5,0];    
_radius=15;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

_location=[26808.3,24674.5,0];    
_radius=8;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

_location=[26762.8,24623.6,0];    
_radius=8;   
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;

 

so just name it as a like Remove_Objects.sqf  as example and i made a folder called Remove_Objects and placed this into a customs folder    example

then call it from your init.sqf like this

[] execVM "Custom\Remove_Objects\Remove_Objects.sqf";

 

i hope this is what you need gl

 

Do I need to place markers on the map to use this?
Just wondering with the markerarray

Share this post


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

Do I need to place markers on the map to use this?
Just wondering with the markerarray

First you want to determine the radius of the array that you need to use, such as 10m radius around that point. Place an item or items at the locations you want to use for the array, something that can easily be identified. For example, I placed a bunch of batteries on the ground where I needed the coordinates. Copy the coord from the mission.sqm file, but you will need to convert them to work with the script.

For example, if you place an object in the editor at the point you need, then grab the coord from the mission.sqm, the coord may look like this:

position[] = {5908.18, 0, 20160.3};

Notice that the format is incorrect, the "0" needs to be at the end of the array. Change the above to look like the format below:

position[] = {5908.18, 20160.3, 0};

You're just moving the "0" to the end, instead of the middle.

 

Once you have the coordinates, you do not need the items on the map anymore. So if you placed a bunch of batteries to grab their coordinates from the mission.sqm, you can delete after you have the coordinates.

As a note, make sure you have exactly enough arrays defined in _markerarray, and you have the correct radius defined per location. This script will remove quite a few items, including buildings, so use with caution and test it out first. I was also warned that removing objects in a very large radius or having a lot of smaller arrays may cause severe lag on startup. Could even crash a server.

Edited by Ninja2dan
  • Thanks 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.