Jump to content
mrwolv

adding loots spawns to custom building ?

Recommended Posts

hiya guys so how would i add loot to custom building i place in the map ?

Share this post


Link to post
Share on other sites

From the modders Discord courtesy of DaOne 

 

*******************HOW TO GENERATE NEW LOOT POSITIONS ON THE MAP FOR YOUR CUSTOM BUILDINGS********************************
                                                -DaOne
First things first, MAKE SURE your custom added buildings SPAWN BEFORE THIS SCRIPT gets execute!! OR ELSE it will not pick up the new buildings!!!
 
Add the following code to any void() That runs after your buildings have spawned!
I recommend to run this code within your mission's BASE CLASS eg CustomMission: MissionServer ( Make a void and name it OnInit )
LIKE THIS:: override void OnInit() { /* Code */  }
INSIDE IT ADD:
 
        CETesting TestHive = GetTesting();
        TestHive.ExportProxyProto();
        TestHive.ExportProxyData( "7500 0 7500", 7000 ); //Dont fuck around with these numbers
 
NOW RUN THE SERVER AND WAIT APPROX 30-60 SECONDS AFTER IT READS THE MISSION!
ONCE YOU SEE THIS IN THE CONSOLE: [CE][MapExport] :: entity found:13722, entity valid:8983, types total:224... took 33 sec
GO TO YOUR STORAGE FOLDER IN THE MISSION, OPEN IT AND YOU SHOULD SEE A NEW FOLDER NAMED 'export' INSIDE IT WILL CONTAIN 2 XML's COPY BOTH AND REPLACE THE OLD ONES WITH THE NEW ONES, MAKE SURE YOU REMOVE THE CODE SO IT DOES NOT GENERATE AGAIN AND RESTART SERVER.

 

Edited by SmashT
  • Beans 1

Share this post


Link to post
Share on other sites
On 2/7/2019 at 8:15 PM, SmashT said:

From the modders Discord courtesy of DaOne 

 


*******************HOW TO GENERATE NEW LOOT POSITIONS ON THE MAP FOR YOUR CUSTOM BUILDINGS********************************
                                                -DaOne
First things first, MAKE SURE your custom added buildings SPAWN BEFORE THIS SCRIPT gets execute!! OR ELSE it will not pick up the new buildings!!!
 
Add the following code to any void() That runs after your buildings have spawned!
I recommend to run this code within your mission's BASE CLASS eg CustomMission: MissionServer ( Make a void and name it OnInit )
LIKE THIS:: override void OnInit() { /* Code */  }
INSIDE IT ADD:
 
        CETesting TestHive = GetTesting();
        TestHive.ExportProxyProto();
        TestHive.ExportProxyData( "7500 0 7500", 7000 ); //Dont fuck around with these numbers
 
NOW RUN THE SERVER AND WAIT APPROX 30-60 SECONDS AFTER IT READS THE MISSION!
ONCE YOU SEE THIS IN THE CONSOLE: [CE][MapExport] :: entity found:13722, entity valid:8983, types total:224... took 33 sec
GO TO YOUR STORAGE FOLDER IN THE MISSION, OPEN IT AND YOU SHOULD SEE A NEW FOLDER NAMED 'export' INSIDE IT WILL CONTAIN 2 XML's COPY BOTH AND REPLACE THE OLD ONES WITH THE NEW ONES, MAKE SURE YOU REMOVE THE CODE SO IT DOES NOT GENERATE AGAIN AND RESTART SERVER.

 

I thought this export didn't work anymore. Has it been fixed?

Share this post


Link to post
Share on other sites

it did not work for me i have had to use a diffrent method to get it to work ile try to explain how i did it

 

Step 1

in your init.c file if you have the following below your objects you added in from the map editor like this below go to step 2

 

 

 


SpawnObject("Land_Mil_Tent_Big3", "12124.700195 141.119995 12680.099609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big3", "12143.400391 141.171005 12671.599609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big4", "12115.599609 141.212006 12661.700195", "18.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12164.799805 141.996994 12659.000000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12173.099609 141.996994 12655.099609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12181.700195 141.996994 12651.200195", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12153.900391 141.996994 12634.500000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12162.700195 141.996994 12630.400391", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12171.099609 141.996994 12626.500000", "-66.000000 0.000000 0.000000");




//INIT ECONOMY--------------------------------------
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year;
	int month;
	int day;
	int hour;
	int minute;

	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

    if (((month <= 9) && (day < 20)) || ((month >= 10) && (day > 20)))
    {
        month = 9;
        day = 20;
		
		GetGame().GetWorld().SetDate(year, month, day, hour, minute);
	}

 

 

Step 2

 

So Find the Following in your init.c and paste above your buildings you added at the top of void main so it looks like this the //INIT WEATHER BEFORE ECONOMY INIT------------------------ should be below

void main()
{
	
	//INIT ECONOMY--------------------------------------
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year;
	int month;
	int day;
	int hour;
	int minute;

	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

    if (((month <= 9) && (day < 20)) || ((month >= 10) && (day > 20)))
    {
        month = 9;
        day = 20;
		
		GetGame().GetWorld().SetDate(year, month, day, hour, minute);
	}

    SpawnObject("Land_Mil_Tent_Big3", "12124.700195 141.119995 12680.099609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big3", "12143.400391 141.171005 12671.599609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big4", "12115.599609 141.212006 12661.700195", "18.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12164.799805 141.996994 12659.000000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12173.099609 141.996994 12655.099609", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_5", "12181.700195 141.996994 12651.200195", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12153.900391 141.996994 12634.500000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12162.700195 141.996994 12630.400391", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_4", "12171.099609 141.996994 12626.500000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_3", "12190.000000 141.996994 12647.299805", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_2", "12199.299805 141.996994 12643.200195", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big2_1", "12179.400391 141.996994 12623.000000", "-66.000000 0.000000 0.000000");
    SpawnObject("Land_Mil_Tent_Big1_5", "12188.500000 140.000000 12619.799805", "-156.000000 0.000000 0.000000");

Then at the bottom of all your spawned in building information add a new line and paste in the following

GetTesting().ExportProxyData("7500 0 7500", 10000);  

 

Save The init.c file boot your server then wait for a few mins and then look in your mp missions folder storage folder and your will see a exported folder inside there you will find a new mapgrouppos.xml stop your server backup your old mapgrouppos.xml and paste the new one in there then go back to your init.c file and add // infront of the //GetTesting().ExportProxyData("7500 0 7500", 10000); otherwise the server will just keep regenerating the file over and cause lots of server lag after you have done all this just boot your server and all your new buildings will have new loot 😄

Share this post


Link to post
Share on other sites

@mrwolv

hi mate, sorry to tag you but im adding in loot spawn to custom buildings. im using banov map and my init files are slightly different. im struggling to fine where to start the building code. tried a few different ways cannot get it right. would appreciate it if you could point me in right direction. heres the start of the init.c file.

/**
 * init.c
 *
 * DayZ Expansion Mod
 * www.dayzexpansion.com
 * © 2020 DayZ Expansion Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 *
*/

void main()
{
    
    bool loadTraderObjects = true;
    bool loadTraderNPCs = true;

    string MissionWorldName = "empty";
    GetGame().GetWorldName(MissionWorldName);

    if (MissionWorldName != "empty")
    {
        //! Spawn mission objects and traders
        ExpansionObjectSpawnTools.FindMissionFiles("$CurrentDir:\\mpmissions\\Expansion." + MissionWorldName, loadTraderObjects, loadTraderNPCs);
    }
    

    //INIT WEATHER BEFORE ECONOMY INIT  newest copy   ------------------------

Edited by Luck914

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

×