Skip to content
abcdefg30 edited this page Aug 17, 2022 · 14 revisions

For custom maps there is the possibility to set lobby options like fog of war or shroud to be on or off.
This article shows how to set default options and lock options (option can't be changed by players in the lobby). Adding custom options important for singleplayer missions is covered in the "Advanced" section.

Note: Map options like the fog-of-war checkbox carry over to the next map if the map is changed. If you define that the f.o.w. checkbox should be checked, then that is only the default suggestion. If the f.o.w. checkbox was unchecked in the previous map, your map will also have f.o.w disabled! To make sure the checkbox is always checked, you also need to lock the option. (set and lock)

Simple

To set map options open your maps .oramap file and edit the map.yaml.
Add a line starting with Rules: at the end of the map file and copy-paste the appropriate options you want and set them to true or false.
Make sure the indentation is right (only tabs on line starts) and that the hierarchy is complete and every entry is unique!

Example:

Rules:
	Player:
		Shroud:
			ExploredMapCheckboxEnabled: true
			ExploredMapCheckboxLocked: true

sets the map shroud to off while

Rules:
Player: # 1) wrong indentation
		Shroud:
		Shroud: # 2) same entry twice
			ExploredMapCheckboxEnabled: true #hierarchy not complete, because of 1) and 2)
			ExploredMapCheckboxLocked = true #wrong syntax

is not correct and causes an error ("This map is not compatible with this version of OpenRA.").

AVAILABLE OPTIONS

In general:

  • XYZEnabled: #checked or unchecked
  • XYZLocked: #can't be changed by the players
  • XYZVisible: #is displayed in the option menu at all.
Rules: 
	World:
		MapOptions:
			TechLevelDropdownLocked: true
			TechLevel: unrestricted
			# other options are infonly, low, medium, nosuper (d2k also has: high)
			ShortGameCheckboxEnabled: true
			ShortGameCheckboxLocked: true
			GameSpeedDropdownLocked: true
			GameSpeed: default
			# other options are slower, fast, faster, fastest
		MapCreeps: #this is only relevant for d2k which has sand worm creeps
			CheckboxLocked: true
			CheckboxEnabled: true
		CrateSpawner: #random crates on/off
			CheckboxEnabled: true
			CheckboxLocked: true
		MapBuildRadius:
			AllyBuildRadiusCheckboxEnabled: true #can build in allies base
			AllyBuildRadiusCheckboxLocked: true
			BuildRadiusCheckboxEnabled: true #no build radius limitations
			BuildRadiusCheckboxLocked: true
		SpawnMPUnits:
			DropdownLocked: true
			StartingUnitsClass: none #this means MCV only
			#other options are light, heavy  (light support and heavy support)
			
	Player:
		Shroud:
			ExploredMapCheckboxEnabled: true
			ExploredMapCheckboxLocked: true
			FogCheckboxLocked: true
			FogCheckboxEnabled: true
		LobbyPrerequisiteCheckbox@GLOBALBOUNTY: #enable kill bounties (only RA)
			Enabled: true
			Locked: true
		LobbyPrerequisiteCheckbox@GLOBALFACTUNDEPLOY: #enable re-deployable MCV (only RA and CNC)
			Enabled: true
			Locked: true
		LobbyPrerequisiteCheckbox@REUSABLEENGINEERS: #enable re-usable engineers (only RA)
			Enabled: true
			Locked: true
		PlayerResources:
			SelectableCash: 2500, 5000, 7500, 10000
			#these are the defaults, make sure to add your desired value into this list!
			DefaultCash: 5000
			#only set to something listed before (other players can't join your game if you don't)
			DefaultCashDropdownLocked: true

Advanced

In missions often the multiplayer starting units, starting spawn points or defeating players with no units on the map is not wanted. Remove those rules with:

Rules:
	World:
		-MPStartLocations:
		-SpawnMPUnits:
		MissionObjectives: 
			EarlyGameOver: true #this means that the game is over once one player is defeated. 
					#This has nothing to do with the short game lobby option.
	Player:
		-ConquestVictoryConditions: #disable defeating a player with no units/buildings

Add a mission script lua file to your map to actually defeat someone if something happens. See Lua API for more information.

Rules:
	World:
		LuaScript:
			Scripts: Your_Mission_Script_file.lua

Add a mission briefing which can be read in the mission browser (singleplayer) or in the lobby chat (multiplayer) and ingame in the briefing tab.

Rules:
	World:
		MissionData:
			Briefing: \nThis is your mission!\n  * Go defeat our enemies!

You can define new dropdowns which you then can use in your mission script. Also custom checkboxes are possible and can be used in yaml files like any other prerequisites.

Rules:
	World:
		ScriptLobbyDropdown@Your_custom_dropdown: #do not use the same name twice after @
			ID: CustomDropdown
			Label: Cust. Drop
			Description: Select some custom option by dropdown!
			Default: entry_1
			Values:
				entry_1: First #doesn't have to be called entry_1 or First.
				entry_2: Second
				entry_3: Third
			Locked: false
			Visible: true 	
			DisplayOrder: 30
	Player:
		LobbyPrerequisiteCheckbox@Your_custom_checkbox: #do not use the same name twice after @
			ID: CustomCheckbox
			Label: Cust. Check
			Description: This is a custom option!
			Enabled: true
			Locked: true
			Visible: true
			DisplayOrder: 20
			Prerequisites: custom_enabled

This short lua script shows how to use the prerequisites of the checkbox and the selected entry of the dropdown in your mission script:

WorldLoaded = function() 
	--print "The host has selected <option>" to the global ingame chat
	Media.Debug("The host has selected "..Map.LobbyOption("CustomDropdown"))
	
 	mp0=Player.GetPlayer("Multi0")
	
	if mp0.HasPrerequisites({"custom_enabled"})
	then Media.Debug("Custom checkbox set") --print "Custom checkbox set" to the global ingame chat
	else Media.Debug("Custom checkbox NOT set")
	end
end

Tick = function()
end

To get more space for your own options you can hide the default ones like "Fog", "Shroud" or "Game Speed". Just add an entry called Visible: false or CheckboxVisible: false or <option>CheckBoxVisible: false. Test it out or see the traits wiki which one is correct.

For developing and testing your map faster, condsider enabling cheats by default:

Rules:
	Player:
		DeveloperMode:
			CheckboxEnabled: true 
			CheckboxLocked: true #these two are enough. Write /all ingame to activate all cheats.

Finally, also very helpful for missions is the option to keep a custom map preview after editing a map and the option to show the map in the mission browser instead of the multiplayer lobby.
Unlike the other options, those must not be preceded by Rules:, just paste them directly into the map.yaml

LockPreview: true #keep map preview
Visibility: MissionSelector #show only in the missions menu

Useful Links:

Players ๐ŸŽฒ

Modders โœ๏ธ

Developers ๐Ÿ”ง

Clone this wiki locally