MapView Python

From Civilization Modding Wiki
Jump to navigationJump to search

Overview

MapView 2.10 and any version above will support Python scripting opportunities. This article tries to give you a decent impression about the things that are possible throught this interface.

How to get a Tile?

This code will iterate over all fields from the currently shown map

for x in range(0, mvMap.GetWidth()):
    for y in range(0, mvMap.GetHeight()):
        mvMap.Tile(x,y)

Simple Script printing the terrain type of all fields

for x in range(0, mvMap.GetWidth()):
    for y in range(0, mvMap.GetHeight()):
        print mvMap.Tile(x,y).Terrain().Get()

Basics

You will have access to several parts of MapView The most important is probably the value "mvMap". "mvMap" is the currently visible Map!