|
|
|
|
May 22nd, 2008, 12:29 AM
|
Corporal
|
|
Join Date: Aug 2007
Posts: 55
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Map-making connundrum
Intermittently while I work on my mod, I'm also making maps, but there is something I'm not clear on. Can somebody explain to me the mechanics of adding and removing provinces to/from an existing map? The controls in the editor don't seem very intuitive, and despite testing I cannot figure out how they work.
|
May 22nd, 2008, 02:01 AM
|
|
Colonel
|
|
Join Date: May 2005
Location: Kansas, USA
Posts: 1,538
Thanks: 289
Thanked 194 Times in 94 Posts
|
|
Re: Map-making connundrum
It is late here and I was just skimming the forums before calling it a night so excuse me for not taking more time to explain the following code. If you are familiar with programming then it shouldn't take to much to convert it to your language of choice. Just replace the map name with your own and replace "212" with the province number that you are removing.
Hope this helps.
Here is a yabasic script that I wrote to fix an existing map file (AomOrc3.map) when I found a bogus pixel in the map image after all of the neighbor work was already done:
Code:
REM used to fix map file after removing province pixel # 212.
OPEN 1, "AomOrc3.map", "r"
OPEN 2, "AomOrc301fixed.map", "w"
while(not eof(1))
x=0
y=0
line input #1 a$
if left$(a$,8)="#terrain" then
x=val(mid$(a$,10,(instr(a$," ",10)-10)))
xx=val(right$(a$,(len(a$)-instr(a$," ",10))))
if x>212 then
x=x-1
a$="#terrain "+str$(x)+" "+str$(xx)
endif
elseif left$(a$,10)="#neighbour" then
i=11
j=instr(a$," ",12)
x=val(mid$(a$,12,j-i-1))
xx=val(mid$(a$,j+1))
if x>212 then
x=x-1
a$="#neighbour "+str$(x)+" "+str$(xx)
endif
if xx>212 then
xx=xx-1
a$="#neighbour "+str$(x)+" "+str$(xx)
endif
elseif left$(a$,6)="#start" then
x=val(mid$(a$,8))
if x>212 then
x=x-1
a$="#start "+str$(x)
endif
elseif left$(a$,9)="#landname" then
x=val(mid$(a$,11,(instr(a$," ",11)-11)))
tmpstr$=mid$(a$,(instr(a$," ",11)+1))
if x>212 then
x=x-1
a$="#landname "+str$(x)+" "+tmpstr$
endif
endif
print #2 a$
end while
CLOSE #1
close #2
|
May 22nd, 2008, 02:14 AM
|
|
National Security Advisor
|
|
Join Date: Oct 2003
Location: Helsinki, Finland
Posts: 5,425
Thanks: 174
Thanked 695 Times in 267 Posts
|
|
Re: Map-making connundrum
The province removed and province added commands in the map editor just don't work as they should. So careful with the white pixels. If you forget to add one, you either need some script to fix all neighbors above that one or you need to redo all map neighbors above it by hand. Removing provinces is very much the same thing.
So you can use Ballbarian's script if you need to remove stuff. I expect an additive script would be similar, but comments in the script would be helpful for us non-programmers to tell us what it does and where.
|
May 22nd, 2008, 08:30 AM
|
|
Colonel
|
|
Join Date: May 2005
Location: Kansas, USA
Posts: 1,538
Thanks: 289
Thanked 194 Times in 94 Posts
|
|
Re: Map-making connundrum
Again, in a rush. Have to leave for a conference.
Added minimal comments:
Code:
REM used to fix map file after removing province pixel # 212.
REM OPEN ORIG MAP FILE FOR READING
OPEN 1, "AomOrc3.map", "r"
REM OPEN/CREATE FIXED MAP FILE
OPEN 2, "AomOrc301fixed.map", "w"
REM READ THE ORIG LINE BY LINE TO END OF FILE
while(not eof(1))
x=0
y=0
line input #1 a$
if left$(a$,8)="#terrain" then
x=val(mid$(a$,10,(instr(a$," ",10)-10)))
xx=val(right$(a$,(len(a$)-instr(a$," ",10))))
REM IF THIS LINE IS TERRAIN AND PROV# GREATER THAN REMOVED PROV# THEN REDUCE PROV# BY 1
if x>212 then
x=x-1
a$="#terrain "+str$(x)+" "+str$(xx)
endif
elseif left$(a$,10)="#neighbour" then
i=11
j=instr(a$," ",12)
x=val(mid$(a$,12,j-i-1))
xx=val(mid$(a$,j+1))
REM IF THIS LINE IS NEIGHBOUR AND PROV# GREATER THAN REMOVED PROV# THEN REDUCE PROV# BY 1 (1ST NEIGHBOUR)
if x>212 then
x=x-1
a$="#neighbour "+str$(x)+" "+str$(xx)
endif
REM IF THIS LINE IS NEIGHBOUR AND PROV# GREATER THAN REMOVED PROV# THEN REDUCE PROV# BY 1 (2ND NEIGHBOUR)
if xx>212 then
xx=xx-1
a$="#neighbour "+str$(x)+" "+str$(xx)
endif
elseif left$(a$,6)="#start" then
x=val(mid$(a$,8))
REM IF THIS LINE IS START AND PROV# GREATER THAN REMOVED PROV# THEN REDUCE PROV# BY 1
if x>212 then
x=x-1
a$="#start "+str$(x)
endif
elseif left$(a$,9)="#landname" then
x=val(mid$(a$,11,(instr(a$," ",11)-11)))
tmpstr$=mid$(a$,(instr(a$," ",11)+1))
REM IF THIS LINE IS LANDNAME AND PROV# GREATER THAN REMOVED PROV# THEN REDUCE PROV# BY 1
if x>212 then
x=x-1
a$="#landname "+str$(x)+" "+tmpstr$
endif
endif
REM PRINT THE LINE WITH ANY CHANGES TO THE FIXED MAP FILE
print #2 a$
end while
CLOSE #1
close #2
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|