Skip to content

4 New Open Save

dreamness edited this page Mar 26, 2025 · 1 revision
from ra3map import Ra3Map

# Create a new map named 'm_1', whose playable area is 300x350, border width is 10, 
# and generate 3 player start waypoints at random position.
m_1 = Ra3Map.new_map(300, 350, 10, 'm_1', 3)

# read a map named 'm_2'
m_2 = Ra3Map.load_map('m_2')

# TODO: MODIFY SOMETHING
... ...

# Fetch some info.
# These infos are read-only.
print(m_2.map_width)
print(m_2.map_height)
print(m_2.map_border_width)
print(m_2.map_playable_width)
print(m_2.map_playable_height)

# save the map
m_2.save()

# save the map as a new file
m_2.save_as('m_3')

Clone this wiki locally