Extra keys in unit_type

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
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Extra keys in unit_type

Post by pyrophorus »

Hi all !
In former versions (at least in 1.12) it was possible to add extra keys in unit_type, say something like "capacity=12" and this extra key was added to the unit created after this definition.
It's still possible to add extra keys in unit_type block, but it seems to me they're no more reported in the unit block itself.
Is this true, or am I missing something ?
Friendly,
User avatar
Elvish_Hunter
Posts: 1588
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Extra keys in unit_type

Post by Elvish_Hunter »

pyrophorus wrote: March 14th, 2022, 10:41 am In former versions (at least in 1.12) it was possible to add extra keys in unit_type, say something like "capacity=12" and this extra key was added to the unit created after this definition.
I don't remember that this possibility was even documented. Certainly I've never used it!
pyrophorus wrote: March 14th, 2022, 10:41 am It's still possible to add extra keys in unit_type block, but it seems to me they're no more reported in the unit block itself.
If this doesn't work any more, I guess you'll have to use the [variables] or [status] (this one only for boolean flags) fields in your units.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Extra keys in unit_type

Post by pyrophorus »

Elvish_Hunter wrote: March 14th, 2022, 5:28 pm I don't remember that this possibility was even documented. Certainly I've never used it!
I don't think it was... I used this for instance to specify how many units can board on a boat. Obviously, the property is shared by all boats of the same type, and it's tempting to set them in the [unit_type].
Elvish_Hunter wrote: March 14th, 2022, 5:28 pm If this doesn't work any more, I guess you'll have to use the [variables] or [status] (this one only for boolean flags) fields in your units.
Unfortunately, [variables] can't be set in [unit_type]. The only way I found to work around is using extra keys in abilities, but it's not as easy to retrieve them.
Friendly,
Post Reply