Custom Maps: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 5: Line 5:
Create a new plugin folder as described on the page above. Your map and all of it's assets (meshes, materials, textures, etc.) must also reside on this folder.
Create a new plugin folder as described on the page above. Your map and all of it's assets (meshes, materials, textures, etc.) must also reside on this folder.
To package the map as a pak follow the procedure "Package your content" as described on the page above.
To package the map as a pak follow the procedure "Package your content" as described on the page above.
Example Office Map pak file:
https://drive.google.com/file/d/1oRrnx4MlWpfnW-GNTdQGmfeetOyqlxgN/view?usp=sharing


At first the pak file with the map must be loaded with the [[LoadPak]] function.
At first the pak file with the map must be loaded with the [[LoadPak]] function.
Line 15: Line 12:


In a future update a function to seamlessly load a new level might be added. Unfortunately in the current engine version this approach is a bit broken.
In a future update a function to seamlessly load a new level might be added. Unfortunately in the current engine version this approach is a bit broken.
Example Office Map pak file:
https://drive.google.com/file/d/1oRrnx4MlWpfnW-GNTdQGmfeetOyqlxgN/view?usp=sharing
Make sure to add the OfficeMap.pak to your package.json.


<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">

Revision as of 12:54, 17 September 2020

Since Onset 1.3.0 you can load your own Unreal Maps/Levels.

Head over to Modding to get started with setting up the Unreal Editor.

Create a new plugin folder as described on the page above. Your map and all of it's assets (meshes, materials, textures, etc.) must also reside on this folder. To package the map as a pak follow the procedure "Package your content" as described on the page above.

At first the pak file with the map must be loaded with the LoadPak function. Then in order to load it, the player must reconnect to the server. The function ConnectToServer has a parameter to specify the new map. The game will load the map and then connect to the server again. A reconnection is required because existing actors and entities on the map (vehicles, objects etc.) are being destroyed by the engine when a new map loads. This method is also the standard way Unreal handles level/map changes.

In a future update a function to seamlessly load a new level might be added. Unfortunately in the current engine version this approach is a bit broken.

Example Office Map pak file: https://drive.google.com/file/d/1oRrnx4MlWpfnW-GNTdQGmfeetOyqlxgN/view?usp=sharing

Make sure to add the OfficeMap.pak to your package.json.

AddEvent("OnPackageStart", function()
	print("OnPackageStart")
	print(GetWorld():GetMapName())
	
        -- If the current map is not the Office2 map then load it.
	if GetWorld():GetMapName() ~= "Office2" then
		LoadPak("OfficeMap", "/OfficeMap/", "../../../OnsetModding/Plugins/OfficeMap/Content/")
	
		local mapname = "/OfficeMap/Office/Maps/Office2"
		ConnectToServer(GetServerIP(), GetServerPort(), "", mapname)
	end
end)