How to disable recruitment of faction units

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
Exemnptier
Posts: 5
Joined: July 3rd, 2020, 3:34 pm

How to disable recruitment of faction units

Post by Exemnptier »

I've been playing this game for a long time and recently got into making my own maps. One of my maps was intended to be a survival challenge where you are surrounded by enemy leaders with way more resources than you. One of the leaders was a giant spider. In the scenario creator, I allowed the giant spider to recruit spiders ( and did the same for a couple other creatures, like slimes being able to recruit slimes). When I decided to try it out, I noticed that all of the creatures also recruited other units, units from the faction they were assigned at the start of the match. I have no idea how to disable this, but I am sure there is a way. In the map "the wilderlands" the black faction can not recruit any units, despite having a faction assigned to them. The only other way I can think of how this would be possible is if you use an addon that adds a faction that only contains an unaffordable unit (for example 20 000 gold), leading to the AI being forced to only recruit what you allowed it to recruit because it wouldn't be able to afford anything else (I hope I did not express myself in a too complicated manner here). Unfortunately, I have no idea how to code and will therefore not be able to create an addon with an unaffordable unit, which means the only option I have is hoping that someone knows how to prevent the recruiting of unwanted units and is willing to share this knowledge.
Sorry if this question has been asked before, but I searched for hours and did not find anything.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: How to disable recruitment of faction units

Post by octalot »

In [side], specify faction=Custom.

I don't know how to make the documentation easier to find, I can only answer so quickly because I had the same problem.
Soliton
Site Administrator
Posts: 1680
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: How to disable recruitment of faction units

Post by Soliton »

In Wilderlands it is done by setting the recruit list to empty in a prestart event:
https://github.com/wesnoth/wesnoth/blob ... #L149-L152
"If gameplay requires it, they can be made to live on Venus." -- scott
Exemnptier
Posts: 5
Joined: July 3rd, 2020, 3:34 pm

Re: How to disable recruitment of faction units

Post by Exemnptier »

Thanks a lot! Still going to take me a bit to figure out where exactly to change the lines and where the file is, but now I at least know what to do.
EtionAiem
Posts: 1
Joined: April 5th, 2021, 3:28 am

Re: How to disable recruitment of faction units

Post by EtionAiem »

It helped me, thanks.

I used the code like that:
[event]
name=prestart
[set_recruit]
side=3
recruit=""
[/set_recruit]
[/event]

So i just needed to put the list i wanted later and boom, done. !
Post Reply