Skip to content

Creating a map (manual)

Emmie edited this page Aug 29, 2022 · 9 revisions

This guide assumes you have already placed the map inside of the world file, if you have not done that, go do that now.

Open the 4jbattle datapack in your text editor, and enter the game folder

go to 4jbattle/functions/game

Please go to ~/setup/teleport/load.mcfunction

Replace templatemap with your map name

Replace id with your map id

Replace x y z with the coordinates to the center of your map

##Template Map
#Small
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 1 in 4jbattle:arena run tp @s x y z
#Large
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 2 in 4jbattle:arena run tp @s x y z
#Large+
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 4 in 4jbattle:arena run tp @s x y z
#Remastered
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 3 in 4jbattle:arena run tp @s x y z

Please go to ~/setup/load.mcfunction

Replace templatemap with your map name

Replace id with your map id

##Template Map
#Small
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 1 run dimensionloader prepareDimension 4jbattle:arena 4jbattle:templatemap_small  4jbattle:game/resource/dimensionloaded
#Large
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 2 run dimensionloader prepareDimension 4jbattle:arena 4jbattle:templatemap  4jbattle:game/resource/dimensionloaded
#Large+
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 4 run dimensionloader prepareDimension 4jbattle:arena 4jbattle:templatemap_largeplus  4jbattle:game/resource/dimensionloaded
#Remastered
execute if score #Store 4j.map matches id if score #Store 4j.maptype matches 3 run dimensionloader prepareDimension 4jbattle:arena 4jbattle:templatemap_remastered  4jbattle:game/resource/dimensionloaded

Its now time to edit mapdecider

go to 4jbattle/functions/mapdecider

Go to ~/loadenabled.mcfunction

Replace templatemap with your map name

#TemplateMap
scoreboard players operation #TemplateMap 4j.enablemap = #TemplateMap 4j.setenablemap

Go to ~/findhighest.mcfunction

Replace templatemap with your map name

Replace id with your map id

#Template Map
execute if score #TemplateMap 4j.enablemap matches 1 if score §a0-1:TemplateMap 4j.mapvote = #highestScore 4j.mapvote run scoreboard players set #Store 4j.map id

Go to ~/randommap.mcfunction

Replace templatemap with your map name

Replace id with your map id

Replace voteid with your map vote id

#Template Map
execute if score #TemplateMap 4j.enablemap matches 1 if score #Store 4j.maprandom matches id run scoreboard players set #Store 4j.map id

Enter the vote folder.

Go to ~/check.mcfunction

Replace templatemap with your map name

Replace id with your map id

##add 1 to TemplateMap's vote count if voted for
#If user has voted for this map
execute if score #templatemap 4j.enablemap matches 1 as @a[scores={4j.playermapvote=id},tag=votetemplatemap] run function 4jbattle:mapdecider/vote/error
#If user hasnt voted for this map yet
execute if score #templatemap 4j.enablemap matches 1 as @a[scores={4j.playermapvote=id}] run function 4jbattle:mapdecider/vote/add/templatemap

go to ~/load.mcfunction

Replace templatemap with your map name

#Template Map
execute if score #templatemap 4j.enablemap matches 1 run scoreboard players set §a0-0:TemplateMap 4j.mapvote 0

go to ~/rmoldvote.mcfunction

Replace templatemap with your map name

##Remove TemplateMap map vote
execute if entity @s[tag=votetemplatemap] run scoreboard players remove §a0-0:TemplateMap 4j.mapvote 1

go to ~/tagreset.mcfunction

Replace templatemap with your map name

##Template Map
tag @s remove votetemplatemap

Go to the add folder

Create a new file and name it templatemap.mcfunction (Replace templatemap with your map name)

Replace templatemap with your map name

##Add vote
scoreboard players add §a0-0:TemplateMap 4j.mapvote 1

##Run global vote commands
function 4jbattle:mapdecider/vote/add/global

##Mark as voted
tag @s add votetemplatemap

Please move back to the functions directory

Enter the menu/load/host directory

Go to ~/mapgui.mcfunction

Replace templatemap with your map name

the values for the trigger commands is dependent on how many maps are installed, you must use a number that is not being used by any other maps.

##TemplateMap
#Enabled
execute if score #templatemap 4j.setenablemap matches 1 run tellraw @s ["",{"text":"[","color":"blue","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 17"}},{"text":"✔","color":"green","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 17"}},{"text":"] Template Map","color":"blue","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 17"}}]
#Disabled
execute if score #templatemap 4j.setenablemap matches 0 run tellraw @s ["",{"text":"[","color":"blue","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 18"}},{"text":"❌","color":"red","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 18"}},{"text":"] Template Map","color":"blue","clickEvent":{"action":"run_command","value":"/trigger 4j.gamecfg set 18"}}]

go to ~/defaults.mcfunction

Replace templatemap with your map name

#Template Map
scoreboard players set #templatemap 4j.setenablemap 1

Within ~/defaults.mcfunction, make sure to increase the mapcount score to match the number of maps installed

Enter the map folder

Create a new folder and name it the same as your map name

Within it, create two files

Replace templatemap with your map name

enable.mcfunction

##Enable map
scoreboard players set #templatemap 4j.setenablemap 1

##Increase mapcount
scoreboard players add #Store 4j.mapcount 1

##Open menu
function 4jbattle:menu/load/host/mapgui

disable.mcfunction

##Disable map
scoreboard players set #templatemap 4j.setenablemap 0

##Decrease mapcount
scoreboard players remove #Store 4j.mapcount 1

##Open menu
function 4jbattle:menu/load/host/mapgui

Now, head all the way back up to 4jbattle/data/4jbattle

Enter ~/loot_tables

Open maprandom.json

Increase the number next to "max": by 1

With this, you are finally done with the code side of things, you will now need to enter builder mode in LEB

To access Builder Mode, you must be opped on the server, you can do with with /op in the server console

Once you are an operator, type /function 4jbattle:build/start

It will open a menu to allow you to edit existing maps, to add your own you must manually find a place for them.

Clone this wiki locally