Jump to content
Syr3L

3den Editor Terrain Objects Script for the debug console

Recommended Posts

Hy guys 'n girls!

I've searched the past 2 hours to "access" terrain objects of a certain class name for later use in my project (for example all fuel stations on altis, or all atms on a specific map, or a bench, or whatever)

Knowing it would not be easy i searched the sctipting category and so on

 

what i came up with is: (btw findNearestObject and sorts wount work cause terrain objects dont have a class name to find ... )

 

_objArray = []; 
{ 
 _modelInfo = ((getModelInfo _x) select 0); 
 if ( (_modelInfo find "model / part of filename you want to search for") > -1) then { 
  _objArray pushBack _x; 
 }; 
} forEach nearestTerrainObjects [[worldSize /2, worldSize/2],["HIDE"],worldSize/2]; 
{
	_editLogic = create3DENEntity ["Logic","ModuleEditTerrainObject_F",position _x];
} forEach _objArray;

 

while its not super efficient it spawns you an Edit Terrain Object - Module at the position of you desired terrain object on the entire map (yeah i know the radius isnt the entire map *cough ... corners ... cough*

 

How it works:
If you know the class-name of your object you can go into the config viewer and search for the entry of the model (pressing ctrl + c to copy into clipoard btw).

with the command

nearestTerrainObject


you are able to select what type of object it is ("HIDE" in case of a bench).

With

getModelInfo

you get an array including the model.p3d name.

 

with the command

find

you are able to search strings and if found it returns the position in a string.

 

if not - it returns -1.

This makes it suitable to filter the filenames and append them into an empty array for later reference.

 

Now the real magic is done with:

 

_editLogic = create3DENEntity ["Logic","ModuleEditTerrainObject_F",position _x];

This creates the Module to edit terrain objects (in the Attributes screen you are able to filter object types (for benches you use [...].

 

Now with this module you can give the object a variable name and therefor you can manipulate this object in certain ways like almost a normal object (i needed to store value in the object (for example the amount of money inside an atm-maschine, people on a bench...).

"All" you need to do after spawning the modules is drag them onto the object you need (an atm f.e.)

 

hope this helps others to create missions

 

 

btw you can use the create3DENEntity to do all kinds of stuff inside the 3Ditor. Infos about create3DENEntity found here....



Happy Editing

 

Syr3L

 

P.S.: Mad Scientist of German (Austrian) Origin ...

Share this post


Link to post
Share on other sites

You can even replace a terrain object by another object (edited) in 3den (at min 2:55).

 

 

 

Share this post


Link to post
Share on other sites

i prefer a vanilla aproach keeping my addons as few as possible but its nice to know

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

×