Jump to content
Sign in to follow this  
Fun Automat

Map modding ? but HOW ?

Recommended Posts

Hello Guys....

I try to add some Buildings to the map, server side - but i still dont understand it...

 

Way 1

https://github.com/Arkensor/DayZCommunityOfflineMode

https://github.com/Arkensor/DayZCommunityOfflineMode/wiki/Add-custom-objects-to-your-server-or-mission

//Spawn helper function
void SpawnObject( string type, vector position, vector orientation )
{
    auto obj = GetGame().CreateObject( type, position );
    obj.SetPosition( position );
    obj.SetOrientation( orientation );
    //Force collision update
    vector roll = obj.GetOrientation();
    roll [ 2 ] = roll [ 2 ] - 1;
    obj.SetOrientation( roll );
    roll [ 2 ] = roll [ 2 ] + 1;
    obj.SetOrientation( roll );
}

//Your custom spawned objects
SpawnObject("Land_Misc_Well_Pump_Yellow", "8680.280508 8.368828 2488.218850", "0.000000 0.000000 0.000000");
SpawnObject("Land_BusStop_City", "8612.080313 8.583845 2463.600586", "64.000008 0.000000 0.000000");
SpawnObject("Land_Misc_Toilet_Mobile", "8613.688811 8.814821 2451.216064", "64.000008 0.000000 0.000000");

This is maybe the best way....but it doesn't really work....because i dont know how to edit the init.c  (errors@start)

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Way 2

BI add some trees on the map,some days ago with this code....

	//-----------------------X-mas
	array<vector> treePositions = { "6560.29 0 2462.12",
									"1652.66 0 14230.71",

									
	};
	

	Object treeEntity;
	for ( int i=0; i < treePositions.Count(); i++ )
	{
		vector treePos = treePositions[i];
		float posY = GetGame().SurfaceY(treePos[0], treePos[2]);
		treeEntity = GetGame().CreateObject("ChristmasTree", Vector( treePos[0], posY, treePos[2]), false);

	}
}

Looks like a complicated copy paste spam job with different item/building ID´s...

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Way 3.

Object obj; 
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13211.099609 -0.615631 3355.631592");
obj.SetOrientation("-112.999969 0.000000 0.000000");
obj.SetPosition("13211.099609 -0.615631 3355.631592");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13203.280273 -0.615631 3374.040771");
obj.SetOrientation("-112.999992 0.000000 0.000000");
obj.SetPosition("13203.280273 -0.615631 3374.040771");
obj = GetGame().CreateObject("Dam_Concrete_20_Floodgate", "13195.469727 -0.615631 3392.459717");
obj.SetOrientation("-112.999992 0.000000 0.000000");
obj.SetPosition("13195.469727 -0.615631 3392.459717");

Its a piece from the Skalisty bridge script....

 

Should i edit the "way 1 code with commands like "createiobject" and "setposition" ?

 

 

 

 

Edited by Fun Automat

Share this post


Link to post
Share on other sites

I can suggest you this way: 

(It's the Way 1 with some change)

On 24/12/2018 at 2:32 PM, Nehr said:

To be easier i've done it like this:

In my init.c 
 


#include "$CurrentDir:\mpmissions\dayzOffline.chernarusplus\(my mapping file).c"

void SpawnObject( string type, vector position, vector orientation )
{
    auto obj = GetGame().CreateObject( type, position );
    obj.SetPosition( position );
    obj.SetOrientation( orientation );
    //Force collision update
    vector roll = obj.GetOrientation();
    roll [ 2 ] = roll [ 2 ] - 1;
    obj.SetOrientation( roll );
    roll [ 2 ] = roll [ 2 ] + 1;
    obj.SetOrientation( roll );
}

in the void main() (just before the last "}" ) i've added: 


AddMyObjects();

And then in my server folder i've created a file: (my mapping file).c and inside i put all my custom buildings like this:
 


void AddMyObjects()
{
    //Custom Nehr
    //Airfield
    SpawnObject("Land_Airfield_Hangar_Green", "4566.678711 345.704529 10186.797852", "58.000217 0.000000 0.000000");
   ...
   ...
}

Don't forget to replace the (my mapping file).c you just put the name you want.



Like this my init.c stay clear and i have a file were there is all my buildings.

Edited by Nehr

Share this post


Link to post
Share on other sites

Thanks...

i do this with the init since some days.... works fine.

 

 

But a clean init looks better... :)

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  

×