List of all available placeable units

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

List of all available placeable units

Post by Pentarctagon »

Is there a way to get a list of all units available for placement via [unit], as well as the data contained within the [unit_type]?

Or to put it another way, what I'm looking for is the programmatic equivalent of (for every unit in the game, as well as potentially any campaign currently being played): placing the unit on the map > [store_unit] > kill the unit and repeat with the next unit.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Ravana
Forum Moderator
Posts: 2952
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: List of all available placeable units

Post by Ravana »

For single-player context, https://wiki.wesnoth.org/InternalAction ... ype_ids.5D and https://wiki.wesnoth.org/LuaWML/Units#w ... unit_types.

However, it is unknown (meaning I havent tested and people I asked didnt know), exactly whose list of available units it gets when there are multiple people available.
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: List of all available placeable units

Post by Pentarctagon »

[store_unit_type_ids]/[store_unit_type] looks like it'll do exactly what I want, thanks!

As for multiplayer, I am not too worried; I just need the data, I'm not actually going to be spawning units at random or something.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Project Manager
Posts: 5531
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: List of all available placeable units

Post by Pentarctagon »

To follow up on this a bit, [store_unit_type_ids] does get all available [unit_type]s - including campaign specific units when the modification is enabled for a campaign. The list of ids it returns is even pre-sorted alphabetically :D
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Ravana
Forum Moderator
Posts: 2952
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: List of all available placeable units

Post by Ravana »

Yes, I changed the wiki to say that it includes all units across all loaded addons.
Post Reply