Need help with terrain macro

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Need help with terrain macro

Post by zookeeper »

I don't think you can make them layer with units as you want, while keeping everything else working right.

Using base144, forests seemed to work as intelligently as they possibly could. That is, almost perfectly. I don't know anything about how base interacts with rotations, if it does (which I doubt).

User avatar
Alarantalara
Art Contributor
Posts: 784
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Need help with terrain macro

Post by Alarantalara »

base does interact with rotations, which is what the x value of base is for. It does nothing until the terrain is rotated. I forget exactly how it works other than noting it as something I needed to write about when I was working on the terrain WML tutorial.

Wussel
Posts: 623
Joined: July 28th, 2012, 5:58 am

Re: Need help with terrain macro

Post by Wussel »

This is not religion or believe system. This is more like facts and science. Something is impacting the "height". Height comes from base. Problematic image files are part of rotate code. Thus the hypothesis. Rotate influences base. I agree it should not. Thus I used the word error. Putting base to 144 solves the tree issue too. And half of my last stacking issue. I put a picture of this for you. Right side bad, left side good. I would assume if I put base to 108, this might be fixed to. Thus my hypothesis would be strengthened even more.

But this is not the purpose of base. I need base 216! Even 144 puts unit in front of wall. I want behind wall. If we make wall unwalkable it would not matter and might even be beneficial for flying units. Good for use by Heindal maybe.

Please look at this issue to. You can see it with the fence too. But for the fence I would not care.
Attachments
issue.png

Wussel
Posts: 623
Joined: July 28th, 2012, 5:58 am

Re: Need help with terrain macro

Post by Wussel »

Yup, Issue solved with base108. However forrest not solved. Maybe not even with 144 as I used bigtree before. Regular forest shows more issues. So I still need a solution. Would it do just to call the 4 used direction for the pictures and scrap the rotate code?

So to be frank: I have the impression that image base coordinates are rotated somehow when using rotate command. I would be happy to be proven wrong.
Attachments
issue-108.PNG

Wussel
Posts: 623
Joined: July 28th, 2012, 5:58 am

Re: Need help with terrain macro

Post by Wussel »

ok guys. it is working. I post the code for you to try.

Problem would be off center base in combination with rotate. Simple solution would be to rotate by hand. I would bet this could fix the notorious castle stacking issue too.

Code: Select all

#define NEW:BIGFENCE TERRAINLIST IMAGESTEM
    [terrain_graphics]
        map="
,  *
2,   2
,  1
2,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,se,sw,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-se-sw-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   2
,  1
*,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,se,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-se-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   *
,  1
2,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[se,sw,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-se-sw-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
2,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,se,sw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-se-sw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   2
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,sw,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-sw-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,se]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-se.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[sw,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-sw-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
2,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[se,sw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-se-sw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   2
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,nw]
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-sw
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-sw
        [/tile]

        [image]
            name={IMAGESTEM}-sw-ne-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-sw
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
             name={IMAGESTEM}-sw-ne-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]


    [terrain_graphics]
        map="
,  *
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-se
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-se
        [/tile]

        [image]
            name={IMAGESTEM}-se-nw-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-se
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
             name={IMAGESTEM}-se-nw-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]


    [terrain_graphics]
        map="
,  *
*,   *
,  1
*,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-nw
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-nw
        [/tile]

        [image]
            name={IMAGESTEM}-nw-se-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
*,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-nw
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
             name={IMAGESTEM}-nw-se-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]


    [terrain_graphics]
        map="
,  *
*,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-ne
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-ne
        [/tile]

        [image]
            name={IMAGESTEM}-ne-sw-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-ne
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

        [image]
             name={IMAGESTEM}-ne-sw-@V.png
            variations="01;02"
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]
	
	
    [terrain_graphics]
        map="
,  *
2,   2
,  1
2,   2
,  *"
        [tile]
            pos=1
            type={TERRAINLIST}
            no_flag=fence
            set_flag=fence,fence-[ne,se,sw,nw]
        [/tile]

        [tile]
            pos=2
            type=!,{TERRAINLIST}
        [/tile]

        [image]
            name={IMAGESTEM}-ne-se-sw-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   *
,  *"
        [tile]
            pos=1
            type=!,{TERRAINLIST}
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-sw
        [/tile]

        [image]
            name={IMAGESTEM}-ne.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]
	
	[terrain_graphics]
        map="
,  *
*,   *
,  1
*,   2
,  *"
        [tile]
            pos=1
            type=!,{TERRAINLIST}
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-nw
        [/tile]

        [image]
            name={IMAGESTEM}-se.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

	[terrain_graphics]
        map="
,  *
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=1
            type=!,{TERRAINLIST}
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-se
        [/tile]

        [image]
            name={IMAGESTEM}-nw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

	[terrain_graphics]
        map="
,  *
*,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type=!,{TERRAINLIST}
        [/tile]

        [tile]
            pos=2
            type={TERRAINLIST}
            has_flag=fence-ne
        [/tile]

        [image]
            name={IMAGESTEM}-sw.png
            layer=0
            base=90,216
            center=90,144
        [/image]
    [/terrain_graphics]

#enddef

Wussel
Posts: 623
Joined: July 28th, 2012, 5:58 am

Re: Need help with terrain macro

Post by Wussel »

I published a palisade together withe the fixed macro as a working add on for the editor in Heindal's "Strange Legacy" thread.


http://forums.wesnoth.org/viewtopic.php ... 80#p591580

Wussel
Posts: 623
Joined: July 28th, 2012, 5:58 am

Re: Need help with terrain macro

Post by Wussel »

I know I did this 4 years ago, but I would like to know how this code is actually working.

The reason is that I came up with a new wall design and finally realized that it would be better to get rid of the invasive endings in neighboring terrains.

Basically if there is only a tile: I would want just a column and not a crossing. So no more endings on the neighbor terrain.

Could I just fix all the needed "2's" to my liking and remove the rest?

By the way the new wall design is really looking nice and is much more in line with regular tiles.

Post Reply