Inconsistent results with Terrain_Graphics.

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.
Post Reply
BajMic
Posts: 46
Joined: January 24th, 2023, 1:22 am

Inconsistent results with Terrain_Graphics.

Post by BajMic »

Hello,

I am struggling with getting consistent results, with the [terrain_graphics] tag. Specifically, the ones with absolute coordinates. Sometimes I get them to work, sometimes I don't and I can't figure out the pattern. The tutorials from website don't seem to work: https://wiki.wesnoth.org/Terraingraphicswml .

Where is a mistake in the following? All map is tagged instead of one specific tile.

Code: Select all

[terrain_graphics]

	x,y=30,17

        [tile]
		x=0
		y=0
            	set_flag=center, x
        [/tile]

        probability=100

[/terrain_graphics]
Thank you.
User avatar
beetlenaut
Developer
Posts: 2829
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Inconsistent results with Terrain_Graphics.

Post by beetlenaut »

There isn't any [image] here. I don't understand how it could work even some of the time without one.

I would take out set_flag (at least at this point), because that could cause inconsistent results if some other, random [tile]s are placed based on the same flags. (Based on what you have, I suspect that you may not understand what flags do in the first place.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Heindal
Posts: 1362
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Inconsistent results with Terrain_Graphics.

Post by Heindal »

There is an example that can be found in the core data. You should know about these macros and where they can be found.
Usually macros can be found inside of: wesnoth\data\core\macros.

But the terrain macros have an folder of their own which is located here: wesnoth\data\core\terrain-graphics
Here you can find some examples in the new-macros.cfg such as:

Code: Select all

 
 
#define NEW:BASE TERRAIN IMAGESTEM
    # Places {IMAGESTEM}[1-11].png as base tiles. Assumes 72x72 hex-shaped
    # images.

#arg IPF
#endarg

#arg FLAG
    base
#endarg

#arg LAYER
    -1000
#endarg

    [terrain_graphics]
        [tile]
            x,y=0,0
            type={TERRAIN}
            set_no_flag={FLAG}

            [image]
                name={IMAGESTEM}@V.png{IPF}
                variations=";2;3;4;5;6;7;8;9;10;11"
                layer={LAYER}
            [/image]
        [/tile]
    [/terrain_graphics]
#enddef

 
I hope it helps and have fun. And yeah, there should be more examples inside the wiki.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Post Reply