My little terrain problem (exists again)

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

My little terrain problem (exists again)

Post by toms »

http://www.wesnoth.org/forum/viewtopic.php?p=152283

Please excuse the kind of meta-thread, but I did not get an answer in the OT forum about this. :(

Just present the problem anew in this thread. It's not strictly a meta-thread since you're trying to get a legitimate question answered independent of what happened in the other thread. This way people don't have to hunt for the question you're trying to ask. -mod

PS give your topic a better title
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Moderator: I will consider that next time.

Same problem gets me again. I simply have no idea why this might not work. But I´m new to this part of WML, so it mustn´t be automatically a difficult issue. (all that appears are black hexes)

Anyway, here is it:

Code: Select all

#define ADJACENT_SIMPLE_MOTHERBOARD
[terrain_graphics]
map="
!xyz

1"
 [tile]
 pos=1
 type=x
 image=motherboard-@R0
 [/tile]
 rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

#  !xyz : Terrains for y and z do not exist this time, but I don´t know how to 
# make sure that it applies to void but not to x,y and z, which will exist in future. 
# (does it cause a problem if they don´t exist?)
#
# The tile should be placed on the same tile as the base, I wanted that so.

#define ADJACENT_2FL_PROB_MOTHERBOARD
#this will be used for follwoing to have transistion variations
[terrain_graphics]
map="
  !xyz
1
  !xyz!
"
 [tile]
 pos=1
 type=x
 image=motherboard-ne-se
 [/tile]
[/terrain_graphics]
[terrain_graphics]
map="
!xyz
   1
!xyz
"
 [tile]
 pos=1
 type=x
 image=motherboard-nw-sw
 [/tile]
[/terrain_graphics]
#enddef

{ADJACENT_MOTHERBOARD}
{ADJACENT_2FL_PROB_M}
Please don´t mind odd macro names now, they are not going for real.
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I had never seen map= used like that, until now when I checked the wiki and the new wikified terrain graphics WML documentation where I saw something like that. What I'd therefore do first would be trying something a bit more...normal.

So this:

Code: Select all

[terrain_graphics]
map="
!xyz

1"
 [tile]
 pos=1
 type=x
 image=motherboard-@R0
 [/tile]
[/terrain_graphics] 
...would become:

Code: Select all

[terrain_graphics]
map="
  2
.   .
  1"
 [tile]
 pos=2
 type=!xyz
 [/tile]
 [tile]
 pos=1
 type=x
 image=motherboard-@R0
 [/tile]
[/terrain_graphics] 
I'm not sure whether that would work either, it was just the first thing that caught my attention.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I made your change. I also changed the test file that it displays a message when the terrain is known. The message did not appear, but I can´t see something wrong.

Code: Select all

[terrain]
image=motherboard-1
id=mainboard
name=_"Motherboard"
char=x
aliasof=g
[/terrain]
{TERRAIN_BASE_PROB x motherboard-1 34}
{TERRAIN_BASE_PROB x motherboard-2 33}
{TERRAIN_BASE_PROB x motherboard-3 33}
Oh, and these are the terrain base macros I used.
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

No clues? :(


EDIT:

Wait. Just the images are not found, I figured out. Seems like something must be wrong here:

{@campaigns/terrain/terrain-graphics.cfg}
{@campaigns/terrain}
{@campaigns/terrain/images}

The folder for the testing campaign is named terrain and an images subdirectory exists in it, where the images are saved.
Do I need [images] ? Or what?
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I´ve added the [images] tag even if I don´t know what it does.

I made a test with PLACE_IMAGE and the result was that the images are found. So I strongly suspect that it´s the WML.

Code: Select all

#define ADJACENT_MOTHERBOARD
[terrain_graphics]
map="
  2
.   .
  1"
 [tile]
 pos=2
 type=!xyz
 [/tile]
 [tile]
 pos=1
 type=x
 image=motherboard-@R0
 [/tile]
 rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

#define ADJACENT_2FL_PROB_M
#this will be used for follwoing to have transistion variations
[terrain_graphics]
map="
  2
1   .
  2
"
 [tile]
 pos=2
 type=!xyz
 [/tile]
 [tile]
 pos=1
 type=x
 image=motherboard-ne-se
 [/tile]
[/terrain_graphics]
[terrain_graphics]
map="
  2
.   1
  2
"
 [tile]
 pos=2
 type=!xyz
 [/tile]
 [tile]
 pos=1
 type=x
 image=motherboard-nw-sw
 [/tile]
[/terrain_graphics]
#enddef

{ADJACENT_MOTHERBOARD}
{ADJACENT_2FL_PROB_M}
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I took this on again. The 1.1.2 version of the game now says: "Illegal character in map found. Scenario cannot be loaded."

character is 'x'.
#ifdef CAMPAIGN_TERRAINTEST

Code: Select all

{@campaigns/terraintest/images}
[terrain]
id=motherboard
image=motherboard-1
name=_"Motherboard"
char=x
aliasof=g
[/terrain]
{TERRAIN_BASE x motherboard-1}
{@campaigns/terraintest}  #this loads the scenario
#endif
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:I took this on again. The 1.1.2 version of the game now says: "Illegal character in map found. Scenario cannot be loaded."
Make sure the terrain WML is defined or included before the map is included or used. Otherwise, the game sees the custom terrain as an unknown terrain type.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I actually used TERRAIN_BASE before the scenario is loaded. Also the terrain type is loaded before and the images before everything.

(I excluded the transistion rules until it works in the basics)
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I solved the problem with invalid characters.

And I now managed to define a working motherboard terrain. Just the images did not appear.
Interesting: I inserted 'grassland' as the image in the TERRAIN_BASE macro and there is still nothing.
First read, then think. Read again, think again. And then post!
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Very much sorry for the triple posting.

I do not get what is wrong here.

Code: Select all

{@campaigns/terraintest/images}
[terrain]
image=motherboard-1
name=_"Motherboard"
aliasof=g
char=x
[/terrain]
{TERRAIN_BASE x motherboard-1}
{@campaigns/terraintest/scenarios}
I do have folders scenarios and images and there are the right files in it, with matching filenames.
Just the image is not found.
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:I do have folders scenarios and images and there are the right files in it, with matching filenames.
Just the image is not found.
Terrain images are searched in images/terrain/ by default. So, putting terrain graphics (motherboard-1.png in this case) in terraintest/images/terrain/ should do the trick.

"WML includes" (the line {@campaigns/terraintest/images}) should also only be used on WML or maps, since it includes the contents of the file or files to the point where the include is used. Think how this is usually used in map_data and you'll see why it doesn't make sense for graphics. If you'll need to include an additional images directory for some reason, you have to use [binary_path].
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I tried, but it does not help. :(

Is it a problem for you to try to get it working in an own test scenario and post the result if it does? (I'll attach the file here then)
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:I tried, but it does not help. :(

Is it a problem for you to try to get it working in an own test scenario and post the result if it does? (I'll attach the file here then)
Sure, I can take a look at it. Just post the whole thing.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Ok, here is the whole test scenario. Thank you.
First read, then think. Read again, think again. And then post!
Post Reply