Managing the recruit list
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.
Managing the recruit list
In the campaign I have defined the recruit list in the first scenario and in later scenario dwarvish fighters should be added to the list. It seems that with [set_recruit] I define the whole list from scratch and that is not what I want*. I assumed that set_extra_recruit does the trick but it doesn't seem to work. The basic list seems to carry on nicely but this addition doesn't.
This is what I have in the event when opponent leader is killed and then the scenario ends. Idea is that after this the dwarves are added to the recruit list among the previous units.
On another note, is it possible to read and store the recruit list into a variable? Do I need to store the whole side to do this?
* the scenarios come in various order and I don't know if the recruit list is already altered. I could keep a boolean variable to track if some unit should be included into recruit list, but this doesn't seem good way because I'm scaling up into several recruitable units and having the list altered in various scenarios.
This is what I have in the event when opponent leader is killed and then the scenario ends. Idea is that after this the dwarves are added to the recruit list among the previous units.
Code: Select all
[message]
speaker=narrator
message= _ "You can recruit Dwarvish Fighters now."
image=units/dwarves/fighter.png
[/message]
[set_extra_recruit]
extra_recruit=Dwarvish Fighter
[/set_extra_recruit]
* the scenarios come in various order and I don't know if the recruit list is already altered. I could keep a boolean variable to track if some unit should be included into recruit list, but this doesn't seem good way because I'm scaling up into several recruitable units and having the list altered in various scenarios.
- James_The_Invisible
- Posts: 536
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Managing the recruit list
There is allow_recruit which allows you to add new unit types to recruit list.
For reading/storing recruit list, see this example: https://github.com/konecnyjakub/For_Pow ... fg#L80-L84.
For reading/storing recruit list, see this example: https://github.com/konecnyjakub/For_Pow ... fg#L80-L84.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Managing the recruit list
The reason [set_extra_recruit] didn't work is that you didn't specify which leader should get the extra recruit. That's what the standard unit filter (mentioned in the wiki) is for. [allow_recruit] works for a side instead of a leader.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Managing the recruit list
Ah, thanks for both. I really should read the API doc more carefully.
(Although, the descriptions could also be bit more clear. Or perhaps the tags could be set_side_recruit & set_leader_recruit...)
(Although, the descriptions could also be bit more clear. Or perhaps the tags could be set_side_recruit & set_leader_recruit...)
So, if I would have two leader, e.g. elf and dwarf, I could use this so that the elf leader could recruit only elf units and dwarf only dwarves? Interesting.beetlenaut wrote:The reason [set_extra_recruit] didn't work is that you didn't specify which leader should get the extra recruit. That's what the standard unit filter (mentioned in the wiki) is for. [allow_recruit] works for a side instead of a leader.