Jump to content
GEORGE FLOROS GR

Trees classnames and Replacement script

Recommended Posts

Hello there to Everyone !

 

I 'm trying to replace the a3 Trees (with the CUP ones)  , but i can't find the classnames.

 

I 'm using the following script to replace the Buildings and i would like to do that , with more objects of the map,

except , if there is another way.

 

 

		 //["Building to replace","replaced Building"]
myBuildings = [["Land_i_Stone_HouseSmall_V3_F","Land_HouseV_1I4",0],
               ["Land_i_House_Big_02_V3_F","Land_HouseV_1T",0],
               ["Land_i_Stone_HouseBig_V2_F","Land_HouseV_2T2",0],
               ["Land_i_House_Big_01_V1_F","Land_HouseV2_01A",0],              
               ["Land_i_Shop_02_V1_F","Land_HouseBlock_C2",0],
               ["Land_i_Shop_02_V3_F","Land_HouseBlock_C5",0],
               ["Land_Slum_House01_F","Land_Shed_W4",0],
               ["Land_Hut06","Land_Shed_W02",0],			   
               ["Land_i_Shop_02_V2_F","Land_HouseBlock_B5",0],	
               ["Land_Slum_House03_F","Land_HouseBlock_B3",0],		
               ["Land_i_House_Small_01_V3_F","Land_HouseBlock_B4",0],	
               ["Land_i_House_Small_01_V2_F","Land_HouseBlock_A1",0],				   
               ["Land_Kiosk_gyros_F","Land_HouseBlock_C4",0],	
               ["Land_d_House_Big_01_V1_F","Land_HouseBlock_C3",0],				   
               ["Land_Unfinished_Building_01_F","Land_HouseBlock_B6",0],	
               ["Land_Factory_Main_F","Land_Ind_Pec_03a",0],	
               ["Land_MilOffices_V1_F","Land_a_stationhouse",0],
               ["Land_i_Stone_HouseBig_V3_dam_F","Land_HouseV_3I2",0],
               ["Land_i_Shed_Ind_F","Land_Shed_Ind02",0],
               ["Land_CarService_F","Land_Repair_center",0],			   
               ["Misc_Cargo1Bo_civil","Land_Shed_M02",0],
               ["Land_i_Stone_HouseBig_V2_dam_F","Land_HouseV_1L1",0],
               ["Land_i_Stone_HouseBig_V1_dam_F","Land_HouseV_1I1",0],
               ["Land_FuelStation_Build_F","Land_Misc_WaterStation",0],
               ["Land_Chapel_V2_F","Land_Church_02a",0],	
               ["Land_i_Stone_Shed_V3_F","Land_HouseV_2L",0],
               ["Land_Chapel_V1_F","Land_HouseV_2I",0],
               ["Land_i_Barracks_V1_F","Land_Mil_House",0],		
               ["Land_Mil_Barracks_i","Land_Mil_Barracks",0],			
               ["Land_Cargo_HQ_V3_F","Land_Mil_Barracks_L",0],	
               ["Land_Airport_Tower_F","Land_Mil_ControlTower",0]                       
               ];		

for "_i" from 0 to(count myBuildings-1) do {

    _CurrentBuilding 	 = (myBuildings select _i) select 0;
    _ReplacementBuilding = (myBuildings select _i) select 1;	
    _DirectionOffset 	 = (myBuildings select _i) select 2;	
    

    {
        systemchat format["getPosATL: %2 getDir: %4 _CurrentBuilding %5",getpos _x, getPosATL _x, getPosASL _x, getdir _x, _x];	
        //diag_log format["getPosATL: %1 getDir: %2 _CurrentBuilding %3 _ReplacementBuilding %4 _x %5", getPosATL _x, getdir _x, _CurrentBuilding, _ReplacementBuilding, _x];	
        hideObjectGlobal  _x;
    
        _myReplacement = createVehicle [_ReplacementBuilding, getPosATL _x, [], 0, "CAN_COLLIDE"];
        _myReplacement setDir (getdir _x) + _DirectionOffset;
        _myReplacement setPosATL (getPosATL _x) ;
        _myReplacement enableSimulationGlobal false;
    } forEach nearestObjects [markerpos "center", [_CurrentBuilding], worldsize];


};
hint "Replacmentscript end";

 Thanks to everyone!

  • Like 2

Share this post


Link to post
Share on other sites

Unfortunately there no tree classnames in vanila arma3.

You can use model name instead by iterate trough all trees of current terrain and get its p3d texture name.

The cup trees have model name as well

_modelpath = [];
{

		_modelpath pushbackUnique ((getModelInfo _x) select 0)
	} 
	forEach nearestTerrainObjects 
	[
		[worldSize/2, worldSize/2], 
		["Tree"], 
		worldSize, 
		false
	];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

The first ones are the altis trees

 ["altis","CUP"]

 

              [["b_ficusc1s_f","CUP_Smrk_siroky",0],
               ["t_FicusB1s_F","CUP_Smrk_maly",0],
               ["b_ficusc2s_f","CUP_t_picea1s",0],
               ["t_FraxinusAV2s_F","CUP_t_picea2s",0],              
               ["t_OleaE1s_F","CUP_t_picea3f",0],
               ["t_OleaE2s_F","CUP_les_singlestrom_b",0],
               ["t_PhoenixC1s_F","CUP_les_singlestrom",0],
               ["t_PhoenixC3s_F","CUP_t_PinusE2s_EP1",0],			   
               ["t_PinusP3s_F","CUP_t_PinusS3s_EP1",0],	
               ["t_PinusS1s_F","CUP_DD_borovice02",0],		
               ["t_PinusS2s_b_F","CUP_DD_borovice",0], 
	       ["t_PinusS2s_F","CUP_DD_borovice",0], 
	       ["t_poplar2f_dead_F","CUP_DD_borovice",0], 
	       ["t_PopulusN3s_F","CUP_DD_borovice",0], 
	       ["t_QuercusIR2s_F","CUP_DD_borovice",0],
	       ["t_ficusb2s_f","CUP_DD_borovice",0]
               ];

Thanks in advance!

Share this post


Link to post
Share on other sites

paste this in init.sqf of your mission

if (isServer) then {

private _repleacearray = [

	["b_ficusc1s_f.p3d", "CUP_Smrk_siroky", 0],
	["t_FicusB1s_F.p3d", "CUP_Smrk_maly", 0],
	["b_ficusc2s_f.p3d", "CUP_t_picea1s", 0],
	["t_FraxinusAV2s_F.p3d", "CUP_t_picea2s", 0],              
	["t_OleaE1s_F.p3d", "CUP_t_picea3f", 0],
	["t_OleaE2s_F.p3d", "CUP_les_singlestrom_b", 0],
	["t_PhoenixC1s_F.p3d", "CUP_les_singlestrom", 0],
	["t_PhoenixC3s_F.p3d", "CUP_t_PinusE2s_EP1", 0],			   
	["t_PinusP3s_F.p3d", "CUP_t_PinusS3s_EP1", 0],	
	["t_PinusS1s_F.p3d", "CUP_DD_borovice02", 0],		
	["t_PinusS2s_b_F.p3d", "CUP_DD_borovice", 0], 
	["t_PinusS2s_F.p3d", "CUP_DD_borovice", 0], 
	["t_poplar2f_dead_F.p3d", "CUP_DD_borovice", 0],
	["t_PopulusN3s_F.p3d", "CUP_DD_borovice", 0], 
	["t_QuercusIR2s_F.p3d", "CUP_DD_borovice", 0],
	["t_ficusb2s_f.p3d", "CUP_DD_borovice", 0]
];


{
	private _a = ((getModelInfo _x) select 0);
	private _c = _repleacearray select {_a == _x select 0};
	
	if !( _c isEqualTo []) then {
	
		private _b = ((getModelInfo _x) select 1);
		private _replacetree = ([(_c select 0) select 1] call BIS_fnc_simpleObjectData) select 1;
		private _directionOffset = (_c select 0) select 2;

		private _position = getPosWorld _x;
		private _vectorDirUp = [vectorDir _x, vectorUp _x];

		hideObjectGlobal  _x;
		private _simpletree = createSimpleObject [_replacetree, _position];
		_simpletree setVectorDirAndUp _vectorDirUp;
		_simpletree setDir (getdir _simpletree) + _directionOffset;
		_simpletree enableSimulationGlobal false;
		
		
	
	};

		
} forEach nearestTerrainObjects 
	[
		[worldSize/2, worldSize/2], 
		["Tree"], 
		worldSize, 
		false
	];
};

If you intend to include bushes too it will take long time before game starts as there are innumerable objects to handle with.

But if you are determined to do this (i assume you are because there are bushes in your array too) you need only change at very bottom from:

 

["Tree"],

to

["Tree","Bush"],

 

  • Like 2

Share this post


Link to post
Share on other sites

That's Fantastic!

 

Just for the question :

there are some (few) placed higher from the ground,

is there any kind of fix about it?

RRv2cNBOTSe0LG9bBY24mQ.png

GMw96yiNRT2hKclzgKhcKQ.pngE8V0WsUJSy29SReXss7g6A.png

Thanks again it 's great!

Share this post


Link to post
Share on other sites

Well you can try to  use diferent positioning method (getPosATL, getPosASL).

Maybe this can do it beter that getPosWorld.

 

private _position = getPosWorld _x;

 

  • Like 2

Share this post


Link to post
Share on other sites

It has to do , (the higher position ) as i see , with the replacing model .

so far tested ,this is the best option in my opinion,

for anyone who wants to check :

if (isServer) then {

private _repleacearray = [

	["t_BroussonetiaP1s_F.p3d", "CUP_b_betula2w_summer", 0],//CUP_les_singlestrom_b
	["t_FicusB1s_F.p3d", "CUP_hrusen2", 0],              
	["t_FicusB2s_F.p3d", "CUP_str_javor", 0],
	["t_FraxinusAV2s_F.p3d", "CUP_t_PistaciaL2s_EP1", 0],
	["t_OleaE1s_F.p3d", "CUP_les_singlestrom", 0], //CUP_t_picea3f	CUP_les_singlestrom
	["t_OleaE2s_F.p3d", "CUP_str_fikovnik2", 0], 			   
	["t_PhoenixC1s_F.p3d", "CUP_misc_BrokenSpruce_PMC", 0], 
	["t_PhoenixC3s_F.p3d", "CUP_misc_TorzoTree_PMC", 0],//CUP_DD_borovice02
	["t_PinusP3s_F.p3d", "CUP_t_picea3f", 0],  //CUP_DD_borovice
	["t_PinusS1s_F.p3d", "CUP_t_picea2s", 0], 
	["t_PinusS2s_b_F.p3d", "Land_HelipadEmpty_F", 0], // *No trees  //CUP_t_PinusS3s_EP1
	["t_PinusS2s_F.p3d", "Land_HelipadEmpty_F", 0], // *No trees  //CUP_t_PinusE2s_EP1
	["t_poplar2f_dead_F.p3d", "CUP_Smrk_maly", 0],  //  CUP_t_picea1s
	["t_PopulusN3s_F.p3d", "CUP_str_vrba", 0], //CUP_Smrk_siroky
	["t_QuercusIR2s_F.p3d", "CUP_str_liskac", 0] 
];


{
	private _a = ((getModelInfo _x) select 0);
	private _c = _repleacearray select {_a == _x select 0};
	
	if !( _c isEqualTo []) then {
	
		private _b = ((getModelInfo _x) select 1);
		private _replacetree = ([(_c select 0) select 1] call BIS_fnc_simpleObjectData) select 1;
		private _directionOffset = (_c select 0) select 2;

		private _position = getPosWorld _x;
		private _vectorDirUp = [vectorDir _x, vectorUp _x];

		
		 
		hideObjectGlobal  _x;
		private _simpletree = createSimpleObject [_replacetree, _position];
		_simpletree setVectorDirAndUp _vectorDirUp;
		_simpletree setDir (getdir _simpletree) + _directionOffset;
		_simpletree enableSimulationGlobal false;
		
		systemchat format["getModelInfo: %1     getPosWorld: %2     replacing tree ",getModelInfo _x, getPosWorld _x,  _x];	

	};

		
} forEach nearestTerrainObjects 
	[
		[worldSize/2, worldSize/2], 
		["Tree"], //["Tree","Bush"],
		worldSize, 
		false
	];
};

hint "Replacing_trees_script done";

 

with less trees for :

t_PinusS2s_b_F.p3d

t_PinusS2s_F.p3d

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 7/2/2018 at 9:28 PM, GEORGE FLOROS GR said:

also this is for checking the class:

 

in the init.sqf :

player addAction ["Check object class (cursor)", "checkclass.sqf"];
execvm "checkclass.sqf";

 

checkclass.sqf


hint str [getModelInfo cursorObject, typeOf cursorObject];
copyToClipboard str [getModelInfo cursorObject, typeOf cursorObject];

Share this post


Link to post
Share on other sites

Just came across this little gem and can't understand how it slipped me by.You're a lifesaver Geerge☺️.Now just need to find some dead tree models to use..like what you'd find on Proving Grounds

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, miasdad said:

Just came across

 

Thank you very much ,  i have a preset for winter , with included trees by CUP.

  • Like 1

Share this post


Link to post
Share on other sites

Hi George, I've been using the script and its great but when I replace the trees on Utes map, they become indestructible - like even a tank can not knock them over. Do you know of a way to fix this please?

Share this post


Link to post
Share on other sites

@mrakos2005

I haven't tried out the script, have you tried enabling simulation?
 

 

Change

_simpletree enableSimulationGlobal false;

 to
 

_simpletree enableSimulationGlobal true;

 

Share this post


Link to post
Share on other sites

@Maff
Thanks for the reply - as far as I can see, the enableSimulationGlobal command is already implemented within George's script. Have to admit its all a little above my pay grade!

Share this post


Link to post
Share on other sites
5 hours ago, mrakos2005 said:

@Maff
Thanks for the reply - as far as I can see, the enableSimulationGlobal command is already implemented within George's script. Have to admit its all a little above my pay grade!

 

My suggestion was to modify the script to set enableSimulationGlobal to true.
I've never used createSimpleObject but reading the BIKI entry, created objects do not handle damage.

 

Quote

Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

I would like to use p3d name for tree that replaces the original tree.Anyone know of how to modify script to do that?

 

Share this post


Link to post
Share on other sites
7 hours ago, ANZACSAS Steven said:

I would like to use p3d name for tree that replaces the original tree.Anyone know of how to modify script to do that?

 

You can use createSimpleObject  which works also with the p3d model, but the trees don't have any simulation (steel ones!)

Example:

 

On contrario, createVehicle needs classes. You can't use the p3d.

 

  • Thanks 1

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

×