Difference between revisions of "ImagePathFunctions"

From The Battle for Wesnoth Wiki
 
m
Line 7: Line 7:
  
 
In the following example, the elvish captain image is given the team color for team 3, making his magenta regions turn a healthy shade of green:
 
In the following example, the elvish captain image is given the team color for team 3, making his magenta regions turn a healthy shade of green:
[message]
+
      [message]
speaker=narrator
+
            speaker=narrator
image=units/elves-wood/captain.png~TC(3,magenta)
+
            image=units/elves-wood/captain.png~TC(3,magenta)
message=_ "Now I am on the green team."
+
            message=_ "Now I am on the green team."
[/message]
+
      [/message]

Revision as of 03:40, 5 September 2006

Image Path Functions provide a simple method for WML coders to alter the way their specified images will be displayed in the game. All of the function parameters are included at the end of an image path.

Currently the only Image Path Function is ~TC(), which takes two comma-separated parameters: the team number and the source color range. The valid values for both of these parameters are defined in the file data/team-colors.cfg

  • team number - this is the first parameter, a number 1-9 signifying the team number of a unit. Number 1 typically means the red team, 2 typically means the blue team, etc.
  • source color range - the second parameter is a source color range, usually magenta. Do not surround this parameter with quotes.

In the following example, the elvish captain image is given the team color for team 3, making his magenta regions turn a healthy shade of green:

     [message]
           speaker=narrator
           image=units/elves-wood/captain.png~TC(3,magenta)
           message=_ "Now I am on the green team."
     [/message]