Jump to content
Hellmaker2a

Custom Map Mod Starter : More easy way for Map Custom Mod

Recommended Posts

Hello, community.


I propose a way to publish the mod having to make map changes like the following Mods:
- Chernarus Islands
- Chernarus Caves
- Prison bridge
and more others...

Currently these mods are suffering from an installation that can be complicated for beginners and a tiring maintenance during updates.

Very often the principle is the same, the contents are in separate several .c files that need to be inserted into the mission root folder, and several changes must be made in the init. c file of the mission root folder like:
- Add a function  "SpawnObject "
- Add instructions #include
- Add a GetTesting().ExportProxyData() function (to regenerate spawn loot)

My project aims to reduce the actions for servers  "Administrators " and make installation/maintenance easier and faster.

HOW?
I am based on using classes that have static methods that are called from the MissionServer and MissionGameplay classes.
Currently all of these classes have the "SpawnObject" function, but it is possible to create a parent class and inherit it in order to further lighten the code, however I have not done so at the moment.

Example of my new map  content file :

class PREFIX_NameOfContent
{	
	void PREFIX_NameOfContent() {}
	
	static void SpawnObject(string objectName, vector position, vector orientation)
	{
		Object obj;
		obj = Object.Cast(GetGame().CreateObject(objectName, "0 0 0"));
		obj.SetPosition(position);
		obj.SetOrientation(orientation);
	 
		//Force update collisions
		if (obj.CanAffectPathgraph())
		{
			obj.SetAffectPathgraph(true, false);
			GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj);
		}
		Print( "(DEBUG) PREFIX_NameOfContent.SpawnObject() Called" );
	}

	static void init()
	{
		/*
		Put your stuff here
		
		SpawnObject( "Land_Container_1Aoh", "14175.851563 -0.059862 2974.020020", "-40.000015 5.000003 0.000000" );
		
		*/
		
		Print( "(DEBUG) PREFIX_NameOfContent class initialized" );
	}
};

Exemple of my init.c file :

modded class MissionServer
{
    void MissionServer()
    {
		PREFIX_NameOfContent.init();
		/*
			Put all your PREFIX_NameOfContent.init() here
		*/
		Print( "(DEBUG) MissionServer() Called" );
    }
};

modded class MissionGameplay
{
    void MissionGameplay()
    {
		PREFIX_NameOfContent.init();
		/*
			Put all your PREFIX_NameOfContent.init() here
		*/
		Print( "(DEBUG) MissionGameplay() Called" );
    }
};

 

Sample files here : https://drive.google.com/file/d/1I7jnQAIFAk2LzOwaKOGsho2D-axkzb6L/view?usp=sharing

You do build your addon with the prefix like "PREFIX/MyMod" (see picture bellow)

AddonBuilder15603490532904808327.png

INSTALLATION OF THE MOD AFTER BUILDED?
Now you just do adding -MOD=@BuilderItems;@MyMod on server and only -MOD=@BuilderItems for the client

Serverside :
- Paste the line bellow in the end of main() function in the init.c of your root mission folder

GetTesting().ExportProxyData( "values", values ); // put your own values

- Start the server few minutes (5 - 10)

- Shutdown the server, and move the file : "YOUR_MISSION_FOLDER/storage_1/export/mapgrouppos.xml" in the root of your mission folder

Remove or comment the line above added in the main() function.

Restart the server and thats all !

 

Enjoy !

Please be cool and dont remove my name in Credits.json (in Special Thanks)

Edited by Hellmaker2a

Share this post


Link to post
Share on other sites

isn't that something similar to community offline mode way? 

you can use only spawnable objects, right? in com code they configured like that

    SpawnObject( "Land_Wall_Gate_Camp", "8382.524414 8.346156 2463.223389", "-117.999969 0.000000 0.000000" );
    SpawnObject( "Land_City_Stand_FastFood", "8383.593750 8.556733 2455.024414", "142.000046 0.000000 0.000000" );
    SpawnObject( "Land_Misc_Well_Pump_Blue", "8375.270508 8.420271 2477.625732", "0.000000 0.000000 0.000000" );
    SpawnObject( "Land_Radio_PanelPAS", "8298.432617 8.081700 2416.478516", "0.000000 0.000000 0.000000" );
    SpawnObject( "Land_BusStation_wall_bench", "8380.612305 6.583596 2468.206787", "-9.000001 0.000000 0.000000" );
    SpawnObject( "Land_BusStation_wall_bench", "8380.114258 6.584270 2471.153564", "-10.000004 0.000000 0.000000" );
    SpawnObject( "Land_BusStation_wall_bench", "8384.984375 6.516644 2458.395996", "141.999985 0.000000 0.000000" );
    SpawnObject( "Land_Misc_Toilet_Mobile", "8376.893555 7.746943 2448.004883", "134.999954 0.000000 0.000000" );
    SpawnObject( "Land_Misc_Toilet_Mobile", "8377.727539 7.818183 2448.887207", "136.999969 0.000000 0.000000" );

 

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

×