Jump to content
Sign in to follow this  
cbfasi

Ghost Objects

Recommended Posts

Seems I have some 'Ghosts' on my map..

How can I remove them?

Replace objects does not show them, yet the object counter says there are 3, even worse I can see them in Bulldozer but not on the map itself.

I would rather not start again as it would also mean rebuilding the complicated road network.

---------- Post added at 08:42 PM ---------- Previous post was at 08:14 PM ----------

Ok I know its not good to answers ones own thread but I got lucky with a last ditch idea that actually worked and I thought I better let others know as I cannot be the only one with the problem.

1. Rename or remove the source p3d of the ghost object.

2. Load up your map with the ghosts..

3. Remove the objects from relevant object group.

4. When you run the object counter you will find the ghost objects have gone.

Share this post


Link to post
Share on other sites

i've made a script that removes ghosts... if i find it it can be useful...

found...

// *************************************************************************************************************
// Copyright (C) 2007 Bohemia Interactive
// *************************************************************************************************************
// This script is free software for any non commercial use; you can redistribute it and/or modify as long as you
// include this licensing notice. This script is distributed in the hope that it will be useful, but without any
// warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
// *************************************************************************************************************
//
// DeleteObjects.vis
//
// *************************************************************************************************************
// This script allows to delete objects on the map, even in the case they are unselectable. 
// To do this, simply add the object to the artificial/natural object list and run the script.
// Warning: this script will DELETE every object of the selected type, not only the unselectable / bugged ones
// How to work: use the option "Objects from list" and select the unselectable objet you need to remove
// *************************************************************************************************************
// THE SCRIPT IS PROVIDED AS-IS AND WITHOUT ANY KIND OF WARRANTY
// SCRIPT ORIGINALLY PROVIDED BY BOHEMIA INTERACTIVE AND REWORKED BY SHEZAN74
// FEEL FREE TO USE AND REWORK THIS FILE AS YOU LIKE, BY KEEPING ORIGINAL COPYRIGHT LICENSING NOTICE
// *************************************************************************************************************


// ---------------------
// functions definitions
// ---------------------

// **********************************************************************************************************
// IsAValidArea
// **********************************************************************************************************
IsAValidArea = 
{
private["_params", "_doc", "_area", "_vertices", "_test"];

// gets document and area 
_params = _this;
_doc  = _params select 0;
_area = _params select 1;

// gets the vertices under the area
_vertices = _doc getVerticesUnder _area;

// core - test validity
_test = true;
if(isnil("_vertices")) then
{
	_test = false;
};

// return value
_test
};


// **********************************************************************************************************
// GetNaturalTemplateNamesInDoc
// **********************************************************************************************************
GetNaturalTemplateNamesInDoc =
{
private["_doc", "_templates", "_templateNames"];

// gets the document
_doc = _this;

// gets 'natural' templates in the document
_templates = _doc getObjectTemplates "natural";
_templates sortBy {getName(_x) strCmp getName(_y)};

// core - gets template names
_templateNames = [];
{
	_templateNames = _templateNames + [getName _x];
} forEach _templates;

// return value
_templateNames
};


// **********************************************************************************************************
// GetArtificialTemplateNamesInDoc
// **********************************************************************************************************
GetArtificialTemplateNamesInDoc =
{
private["_doc", "_templates", "_templateNames"];

// gets the document
_doc = _this;

// gets 'artificial' templates in the document
_templates = (_doc getObjectTemplates "artificial");
_templates sortBy {getName(_x) strCmp getName(_y)};

// core - gets template names
_templateNames = [];
{
	_templateNames = _templateNames + [getName _x];
} forEach _templates;

// return value
_templateNames
};


// **********************************************************************************************************
// ErrorDialog
// **********************************************************************************************************
ErrorDialog =
{
private["_type", "_title", "_messageRow1", "_messageRow2", "_dlgError", "_result"];

// gets the type of warning
_type = _this;

// sets title and message
_title = "";
_messageRow1 = "";
_messageRow2 = "";
switch(_type) do
{
	case 1:
 		{
			_title = "Error in script execution";
			_messageRow1 = "Error in opening the specified file.";
 		};
	default
	 	{
			_title = "Warning - Error in dialog setting";
			_messageRow1 = "Error in ErrorDialog function.";
	 	};
}; 

// sets dialog
_dlgError = [220, 55, _title,
	      ["label", 200, 13, _messageRow1, 0], ["break"],
      	["label", 200, 13, _messageRow2, 0], ["break"],
   			["ok-button", 50, 13]];

// shows the dialog
_result = dialogBox _dlgError;

// return value
_result
};


// **********************************************************************************************************
// SetTemplatesList
// **********************************************************************************************************
SetTemplatesList =
{
private["_params", 
	  "_wantsNatural", "_wantsArtificial", 
	  "_naturalTemplsInDoc", "_artificialTemplsInDoc", 
	  "_templateNames"];

// gets the params
_params = _this;
_wantsNatural          = _params select 0;
_wantsArtificial       = _params select 1;
_naturalTemplsInDoc    = _params select 2;
_artificialTemplsInDoc = _params select 3;

// core - gets template names
_templateNames = [];

if (_wantsNatural) then
{
	_templateNames = _naturalTemplsInDoc;		 
};
if (_wantsArtificial) then
{
	_templateNames = _templateNames + _artificialTemplsInDoc;		 
};

// return value
_templateNames
};





// ---------------------------------
// internal variables default values
// ---------------------------------
_scriptName                    = "Delete Objects 1.0.0";
_areaObjects                   = [];
_selObjects                    = [];
_nAreaObjects                  = 0;
_nSelObjects                   = 0;
_nNaturalTemplateNamesInDoc    = 0;
_nArtificialTemplateNamesInDoc = 0;
_lblNAreaObjects               = "0 [No area selected]";
_lblNSelObjects                = "0 [No object selected]";
_showNaturalTemplateNames      = true;
_showArtificialTemplateNames   = true;
_naturalTemplateNamesInDoc     = [];
_artificialTemplateNamesInDoc  = [];
_selTemplates                  = 0;
_templatesList                 = [];
_saveAreaObjects               = false;
_saveSelObjects                = false;
_saveListObjects               = false;
_saveH                         = false;
_saveT                         = true;
_saveX                         = true;
_saveY                         = true;
_saveZrel                      = true;
_saveZass                      = false;
_saveO                         = true;
_dataSeparator                 = 0;
_fileName                      = "";
_lineCounter                   = 0;


echo "-----------------";
echo "ExportObjects.vis";
echo "-----------------";

// ------------------------
// gets the active document
// ------------------------
_doc = getActiveDoc;    

// ------------------------------
// gets the templates in document
// ------------------------------
_naturalTemplateNamesInDoc = _doc call GetNaturalTemplateNamesInDoc;
_artificialTemplateNamesInDoc = _doc call GetArtificialTemplateNamesInDoc;
_nNaturalTemplateNamesInDoc = count _naturalTemplateNamesInDoc;
_nArtificialTemplateNamesInDoc = count _artificialTemplateNamesInDoc;

// --------------------
// verify the templates 
// --------------------
_thereAreNaturalTemplateNames = false;
if(_nNaturalTemplateNamesInDoc > 0) then
{
_thereAreNaturalTemplateNames  = true;
};

_thereAreArtificialTemplateNames = false;
if(_nArtificialTemplateNamesInDoc > 0) then
{
_thereAreArtificialTemplateNames = true;
};

// ----------------------
// gets the selected area 
// ----------------------
_area = getSelectedArea _doc;

// ------------------------
// verify the selected area 
// ------------------------
_thereIsAnArea = false;
if (([_doc, _area] call IsAValidArea)) then    // there is an area selected in the document
{
_thereIsAnArea = true;
// ------------------------
// gets the objects in area
// ------------------------
_areaObjects = _doc getObjectsIn _area;
_nAreaObjects = count _AreaObjects;
_lblNAreaObjects = str _nAreaObjects;
};

// -------------------------
// gets the selected objects
// -------------------------
_selObjects = getSelectedPosEdObjects _doc;
_nSelObjects = count _selObjects;

// ---------------------------
// verify the selected objects 
// ---------------------------
_thereIsSelection = false;
if (_nSelObjects > 0) then    // there are objects selected in the document
{
_thereIsSelection = true;
_lblNSelObjects = str _nSelObjects;
};

// -----------------------
// sets the templates list
// -----------------------
_templatesList = [_showNaturalTemplateNames, _showArtificialTemplateNames, _naturalTemplateNamesInDoc, _artificialTemplateNamesInDoc] call SetTemplatesList;

// -------------------
// dialogs definitions
// -------------------
_dlgInput = [330, 380, _scriptName,
	["init",
		  {
			if(_thereAreNaturalTemplateNames) then
			{
				{
					_x dlgEnableControl true;
				} forEach dlgGetControls "_showNaturalTemplateNames";
			}
			else
			{
				{
					_x dlgEnableControl false;
				} forEach dlgGetControls "_showNaturalTemplateNames";
			};

			if(_thereAreArtificialTemplateNames) then
			{
				{
					_x dlgEnableControl true;
				} forEach dlgGetControls "_showArtificialTemplateNames";
			}
			else
			{
				{
					_x dlgEnableControl false;
				} forEach dlgGetControls "_showArtificialTemplateNames";
			};

			if(_thereIsAnArea) then
			{
				{
					_x dlgEnableControl true;
				} forEach dlgGetControls "_saveAreaObjects";
			}
			else
			{
				{
					_x dlgEnableControl false;
				} forEach dlgGetControls "_saveAreaObjects";
			};

			if(_thereIsSelection) then
			{
				{
					_x dlgEnableControl true;
				} forEach dlgGetControls "_saveSelObjects";
			}
			else
			{
				{
					_x dlgEnableControl false;
				} forEach dlgGetControls "_saveSelObjects";
			};

			if(_thereAreNaturalTemplateNames || _thereAreArtificialTemplateNames) then
			{
				{
					_x dlgEnableControl true;
				} forEach dlgGetControls "_saveListObjects";
			}
			else
			{
				{
					_x dlgEnableControl false;
				} forEach dlgGetControls "_saveListObjects";
			};

			if(!(_thereAreNaturalTemplateNames) && !(_thereAreArtificialTemplateNames) && !(_thereIsAnArea) && !(_thereIsSelection)) then
			{
				_id = 1;
				_id dlgEnableControl false;
			}
			else
			{
				if((count _fileName) == 0) then
				{
					_id = 1;
					_id dlgEnableControl false;
				}
				else
				{
					_id = 1;
					_id dlgEnableControl true;
				};
			};
		  }],
	["begin-subframe", 320, 190, " Selection "],
	    	["label", 130, 13, "Number of objects selected within area:", 0], 
	    	["dynlabel", 70, 13, "_lblNAreaObjects", 0], ["break"],
	    	["label", 130, 13, "Number of objects selected:", 0], 
	    	["dynlabel", 70, 13, "_lblNSelObjects", 0], ["break"],
		["begin-subframe", 310, 140, " Templates in document "],
			["extended-listbox", 200, 120, "_selTemplates", _templatesList], 
			["begin-subframe", 95, 120, ""],
			    	["check-box", 80, 13, "Natural objects", "_showNaturalTemplateNames"], 
				["onclick",
						{
							_templatesList = [_showNaturalTemplateNames, _showArtificialTemplateNames, _naturalTemplateNamesInDoc, _artificialTemplateNamesInDoc] call SetTemplatesList;
							"_selTemplates" dlgUpdateList _templatesList;	

							if(_showNaturalTemplateNames || _showArtificialTemplateNames) then
							{
								{
									_x dlgEnableControl true;
								} forEach dlgGetControls "_saveListObjects";
							}
							else
							{
								_saveListObjects = false;
								dlgUpdate "_saveListObjects";

								{
									_x dlgEnableControl false;
								} forEach dlgGetControls "_saveListObjects";
							};

							if(!(_showNaturalTemplateNames) && !(_showArtificialTemplateNames) && !(_thereIsAnArea) && !(_thereIsSelection)) then
							{
								_id = 1;
								_id dlgEnableControl false;
							}
							else
							{
								if((count _fileName) == 0) then
								{
									_id = 1;
									_id dlgEnableControl false;
								}
								else
								{
									if(_saveAreaObjects || _saveSelObjects || _saveListObjects) then
									{
										_id = 1;
										_id dlgEnableControl true;
									}
									else
									{
										_id = 1;
										_id dlgEnableControl false;
									};
								};
							};
						}], ["break"],
			    	["check-box", 80, 13, "Artificial objects", "_showArtificialTemplateNames"], 
				["onclick",
						{
							_templatesList = [_showNaturalTemplateNames, _showArtificialTemplateNames, _naturalTemplateNamesInDoc, _artificialTemplateNamesInDoc] call SetTemplatesList;
							"_selTemplates" dlgUpdateList _templatesList;

							if(_showNaturalTemplateNames || _showArtificialTemplateNames) then
							{
								{
									_x dlgEnableControl true;
								} forEach dlgGetControls "_saveListObjects";
							}
							else
							{
								_saveListObjects = false;
								dlgUpdate "_saveListObjects";

								{
									_x dlgEnableControl false;
								} forEach dlgGetControls "_saveListObjects";
							};

							if(!(_showNaturalTemplateNames) && !(_showArtificialTemplateNames) && !(_thereIsAnArea) && !(_thereIsSelection)) then
							{
								_id = 1;
								_id dlgEnableControl false;
							}
							else
							{
								if((count _fileName) == 0) then
								{
									_id = 1;
									_id dlgEnableControl false;
								}
								else
								{
									if(_saveAreaObjects || _saveSelObjects || _saveListObjects) then
									{
										_id = 1;
										_id dlgEnableControl true;
									}
									else
									{
										_id = 1;
										_id dlgEnableControl false;
									};
								};
							};
						}], ["break"],
			["end-subframe"], ["break"],
		["end-subframe"], ["break"],
	["end-subframe"], ["break"],
	["begin-subframe", 320, 60, " Objects to save "],
	    	["check-box", 80, 13, "Area objects", "_saveAreaObjects"], 
		["onclick",
				{
					if((count _fileName) == 0) then
					{
						_id = 1;
						_id dlgEnableControl false;
					}
					else
					{
						if(_saveAreaObjects || _saveSelObjects || _saveListObjects) then
						{
							_id = 1;
							_id dlgEnableControl true;
						}
						else
						{
							_id = 1;
							_id dlgEnableControl false;
						};
					};
				}], ["break"],
	    	["check-box", 80, 13, "Selected objects", "_saveSelObjects"], 
		["onclick",
				{
					if(!(_showNaturalTemplateNames) && !(_showArtificialTemplateNames) && !(_thereIsAnArea) && !(_thereIsSelection)) then
					{
						_id = 1;
						_id dlgEnableControl false;
					}
					else
					{
							if(_saveAreaObjects || _saveSelObjects || _saveListObjects) then
							{
								_id = 1;
								_id dlgEnableControl true;
							}
							else
							{
								_id = 1;
								_id dlgEnableControl false;
							};

					};
				}],["break"],
	    	["check-box", 80, 13, "Objects from list", "_saveListObjects"], 
		["onclick",
				{
					if(!(_showNaturalTemplateNames) && !(_showArtificialTemplateNames) && !(_thereIsAnArea) && !(_thereIsSelection)) then
					{
						_id = 1;
						_id dlgEnableControl false;
					}
					else
					{
							if(_saveAreaObjects || _saveSelObjects || _saveListObjects) then
							{
								_id = 1;
								_id dlgEnableControl true;
							}
							else
							{
								_id = 1;
								_id dlgEnableControl false;
							};

					};
				}],
				["break"],
	["end-subframe"], ["break"],

	["ok-button", 50, 13], ["cancel-button", 50, 13]];


_dlgOutput = [220, 100, _scriptName,
	 ["dynlabel", 200, 13, "_lineCounter", 2], ["break"],
	 ["label", 200, 13, "objects deleted", 2], ["break"],
		 ["ok-button", 50, 13]];


// -----------
// script core 
// -----------

// shows the input dialog
_result = dialogBox _dlgInput;

if(_result == 1) then
{
// ---------------------------
// sets the file to be written
// ---------------------------
	if(_saveAreaObjects) then     // objects under selection area
	{
		{
			delete _x;
			_linecounter = _linecounter + 1
		} forEach _areaObjects;
	};

	if(_saveSelObjects) then
	{
		{
			delete _x;
			_linecounter = _linecounter + 1
		} forEach _selObjects;
	};

	if(_saveListObjects) then
	{
		{
			_selName = _templatesList select _x;				
			_objsX = _doc getObjectsWithTemplate _selName;

			{
			delete _x;
			_linecounter = _linecounter + 1
			} forEach _objsX;

		} forEach _selTemplates;
	};

	// shows the output dialog
	_result = dialogBox _dlgOutput;

};

Edited by shezan74

Share this post


Link to post
Share on other sites

I will try this out when I get my next run of ghosts, tks Shezan

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
Sign in to follow this  

×