skip to Main Content

General Functions

map.ClearAll(): destroys all map data including frontiers, provinces, cities, mountpoints and any drawn surface. Useful to initialize and create a map procedurally using scripting.

map.paused: pauses the game ON/OFF.

map.timeSpeed: controls the speed of time flow. Defaults to 1.

map.cacheMaterials: by default WMSK caches all materials generated by coloring functions, so for instance, when using the same color to cover another cell, WMSK will reuse the same material. If you want to disable this behaviour and force WMSK to create a new material per cell, country or province regardless of the color, set this property to false.

Country related

map.countries: the array of Country objects. Note that the number and indexes of countries varies between the low and high-definition geodata files (reloaded when you change the frontiersQuality property in the inspector or in the API).

map.GetCountryIndex(name): returns the index of the country in the array.

map.GetCountry(index): returns the country object by its index. Equals to map.countries[index].

map.GetCountry(name): returns the country object by its name or null if not found.

map.GetCountryIndex(ray, out countryIndex, out regionIndex): find the country pointed by the ray.

map.GetCountryIndex(Vector2 localPosition): returns de country index that contains given local position.

map.GetCountryIndexByFIPS10_4(fips): returns the index of the country in the collection by FIPS code.

map.GetCountryIndexByISO_A2(iso_a2): returns the index of the country in the collection by ISO 2-character code.

map.GetCountryIndexByISO_A3(iso_a3): returns the index of the country in the collection by ISO 3-character code.

map.GetCountryIndexByISO_N3(iso_n3): returns the index of the country in the collection by ISO 3-digit code.

map.GetCountryCenter(int countryIndex): returns the geometric center of the biggest region of the country.

map.GetCountryCentroid(int countryIndex): returns the geographic center of the biggest region of the country (this will always fall inside the polygon).

map.GetCountryNames(groupByContinent): returns an array with the country names, optionally grouped by continent.

map.GetVisibleCountries (): returns a list of countries that are completely or partly visible on the screen.

map.GetVisibleCountriesInWindowRect (): returns a list of countries that are inside the window rectangle (optional rect constraint set in the inspector or using windowRect).

map.countryHighlighted: returns the Country object for the country under the mouse cursor (or null).

map.countryHighlightedIndex: returns the index of country under the mouse cursor (or null if none).

map.countryRegionHighlighted: returns the Region object for the highlighted country (or null). Note that many contries have more than one region. The field mainRegionIndex of the Country object specified which region is bigger (usually the main body, being the rest islands or foreign regions).

map.countryRegionHIghlightedIndex: returns the index of the region of currently highlighted country for the regions field of country object.

map.countryLastClickedIndex: returns the index of last country clicked.

map.countryRegionHighlightedShape: returns the shape (gameobject) of the currently highlighted region.

map.enableCountryHighlight: set it to true to allow countries to be highlighted when mouse pass over them.

map.highlightAllCountryRegions: whether all regions of active country should be highlighted or just the one under the pointer (some countries can have more than one land region).

map.fillColor: color for the highlight of countries.

map.showCountryNames: enables/disables country labeling on the map.

map.showOutline: draws a border around countries highlightes or colored.

map.outlineColor: color of the outline.

map.showFrontiers: show/hide country frontiers. Same than inspector property.

map.frontiersDetail: detail level for frontiers. Specify the frontiers catalog to be used.

map.frontiersColor: color for all frontiers.

map.frontiersDynamicWidth: changes the width of the country frontiers automatically based on distance of camera to the map.

map.RenameCountry(oldName, newName): allows to change the country’s name. Use this method instead of changing the name field of the country object.

map.BlinkCountry(country, color1, color2, duration, speed): makes the country specified toggle between color1 and color2 for duration in seconds and at speed rate.

map.FlyToCountry(name): start navigation at navigationTime speed to specified country. The list of country names can be obtained through the cities property.

map.FlyToCountry(index): same but specifying the country index in the countries list.

map.ToggleCountrySurface(name, visible, color): colorize one country with color provided or hide its surface (if visible = false).

map.ToggleCountrySurface(index, visible, color): same but passing the index of the country instead of the name.

map.ToggleCountryMainRegionSurface(index, visible, color, Texture2D texture): colorize and apply an optional texture to the main region of a country.

map.ToggleCountryRegionSurface(countryIndex, regionIndex, visible, color): same but only affects one single region of the country (not province/state but geographic region).

map.HideCountrySurface(countryIndex): un-colorize / hide specified country.

map.HideCountryRegionSurface(countryIndex): un-colorize / hide specified region of a country (not province/state but geographic region).

map.HideCountrySurfaces: un-colorize / hide all colorized countries (cancels ToggleCountrySurface).

map.ToggleCountryOutline(countryIndex, visible, texture, borderWidth, tintColor, …): draws an outline around the given country (or hide it if visible is set to false). This method includes all regions of the country.

map.ToggleCountryMainRegionOutline(countryIndex, visible, texture, borderWidth, …): draws an outline around the given country (or hide it if visible is set to false). Only affects the main region of the country.

map.ToggleCountryRegionOutline(countryIndex, regionIndex, visible, texture, borderWidth, …): draws an outline around the given country (or hide it if visible is set to false). Only affects specified region index.

map.CountryNeighbours(countryIndex): returns the list of country neighbours.

map.CountryNeighboursOfMainRegion(countryIndex): same but taking into account only the main region of the province (just in case the province could have more than one land region).

map.CountryNeighboursOfCurrentRegion(): same but taking into account the currently highlighted province.

map.CountryCreate(name, continent): returns a new country object with name and continent (name must be unique!).

map.CountryAdd(country): adds a new country object created with “New Country(…)” instead of Country Create.

map.countryAttributeFile: name of the resource jSON file storing attributes for countries.

map.GetCountryGeoData(): returns a string with all countries frontiers and data.

map.SetCountryGeoData(): loads countries frontiers and data from a string.

map.GetCountriesAttributes(prettyPrint): returns a JSON-formatted string with all attributes

for all countries.

map.GetCountriesAttributes(countries, prettyPrint): same but for a list of countries.

map.SetCountriesAttributes(jSON): sets the attributes of a list of countries contained in the JSON-formatted string.

map.GetCountryCoastalPoints(countryIndex): returns a list of map position where the coast of a country is.

map.GetCountryFrontierPoints(countryIndex1, regionIndex, worldSpace): returns a list of points of the given country region. Optionally in world space.

map.GetCountryFrontierPoints(countryIndex1, countryindex2): returns a list of map position where two given countries share frontiers.

map.GetCountryZoomExtents(index): gets the required zoom level to show a custom country within screen borders (including all its regions! If some regions are far away, it might not zoom properly since entire or large part of the world must be visible!).

map.GetCountryRegionZoomExtents(index, region): gets the required zoom level to show a custom country within screen borders (this will only include the main region or a given region.

map.GetCountryRegionSurfaceGameObject(countryIndex, regionIndex): returns the cached surface of the colored country (if not colored, this function will return null).

map.GetCountryRegion(localPosition): returns the region object located at given map coordinates.

map.CountryTransferCountry (countryIndex, sourceCountryIndex, redraw): source country identified by sourceCountryIndex is conquered/absorbed by countryIndex. Redraw parameter optionally redraws frontiers to reflect the new country perimeters.

map.CountryTransferCountryRegion(countryIndex, sourceCountryRegion, redraw): same than before but using a source region object (it transfer entire country though). SourceCountryRegion is conquered/absorbed by countryIndex. Redraw parameter optionally redraws frontiers to reflect the new country perimeters.

map.CountryTransferProvince (targetCountryIndex, provinceIndex): calls CountryTransferProvinceRegion using the main region of the given province.

map.CountryTransferProvinceRegion (targetCountryIndex, provinceRegion, redraw): province is absorbed by the given countryIndex. The country frontiers are expanded (borders are modified). Redraw parameter optionally redraws frontiers to reflect the new country perimeters.

map.CountryTransferProvinces (targetCountryIndex, provinces, redraw): transfers a list of provinces to target country.

map.CountryTransferCell (targetCountryIndex, cellIndex, redraw): cell is absorbed by the given countryIndex. Redraw parameter optionally redraws frontiers to reflect the new country perimeters.

map.CountryRemoveCell (countryIndex, cellIndex, redraw): cell is removed from target country. Redraw parameter optionally redraws frontiers to reflect the new country perimeters.

map.CountrySetProvinces (countryIndex, provinces, mergeRegions, updateCities, updateMountPoints): this method will discard any province and regions from the given country and add all provinces to the country from the provinces list. If mergeRegions parameter is true, this operation will also merge all province regions so the country frontiers match the borders of the new provinces. The updateCities and updateMountPoints, if true, will update the country index of any city or mount points contained in those provinces (default = true). Please note that if the provinces belong to another country, they won’t be substracted or removed from the other country. Call CountryRemoveProvinces on the other country to update the source country.

map.CountryAddProvinces(countryIndex, provinces, mergeRegions, updateCities, updateMountPoints): this method adds the provinces to the existing provinces of a country and operates as CountrySetProvinces.

map.CountryRemoveProvinces(countryIndex, provinces, mergeRegions): this method removes the provinces from a country and then calls CountrySetProvinces on the remaining provinces.

map.CountryDeleteProvinces (countryIndex): remove all provinces from a given country.

Back To Top