Random Recruit mod

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
User avatar
Atreides
Posts: 1075
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Random Recruit mod

Post by Atreides »

Well I can't seem to find an extant thread so I'll start one just so I can rave: This is more fun than a box full of kittens! ^-^

P.S. Found a little problem with it.

Seems that for no reason I can think of it is limited to level 1 recruits only. Even default has L0 recruits and of course many addons have L2 recruits. I have not tried it with Age of Heroes but I suppose that would have the same recruits as default.

The thing is written 100% in lua but fortunately I was able to edit it anyways to simply remove the limit and when tested it works fine giving me L0 and L2 recruits also.

Here is my fix for anyone who wants it:

Code: Select all

local function init_era()
	if wesnoth.scenario.era then
		for multiplayer_side in helper.child_range(wesnoth.scenario.era, "multiplayer_side") do
			local units = multiplayer_side.recruit or multiplayer_side.leader or ""
			for _, unit in ipairs(split_comma(units)) do
				local unit_type = wesnoth.unit_types[unit]
				if era_set[unit] == nil and unit_type
                -- and unit_type.level == 1 
                then
					era_set[unit] = true
					era_array[#era_array + 1] = unit
				end
			end
		end
		era_set = nil  -- free up memory
	else
		era_array = {
			"Cavalryman", "Horseman", "Spearman", "Fencer", "Heavy Infantryman", "Bowman", "Mage",
			"Merman Fighter", "Elvish Fighter", "Elvish Archer", "Elvish Shaman", "Elvish Scout", "Wose",
			"Merman Hunter", "Orcish Grunt", "Troll Whelp", "Wolf Rider", "Orcish Archer",
			"Orcish Assassin", "Naga Fighter", "Skeleton", "Skeleton Archer", "Ghost", "Dark Adept",
			"Ghoul", "Dwarvish Guardsman", "Dwarvish Fighter", "Dwarvish Ulfserker", "Dwarvish Thunderer",
			"Thief", "Poacher", "Footpad", "Gryphon Rider", "Drake Burner", "Drake Clasher",
			"Drake Glider", "Drake Fighter", "Saurian Skirmisher", "Saurian Augur"
		}
	end
end
I merely commented out the and unit_type.level == 1 which was simple enough since how to comment out things is the first bit of lua I've learned. : )
Oh yeah this is in the main.lua file.
needmoreplayers
Posts: 67
Joined: November 17th, 2023, 7:33 pm

deleted dont care about all the problems of this game anymore

Post by needmoreplayers »

deleted dont care about all the problems of this game anymore
Last edited by needmoreplayers on January 9th, 2024, 8:09 pm, edited 2 times in total.
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: addon?

Post by gnombat »

needmoreplayers wrote: November 17th, 2023, 11:34 pm how do you contact any of the addon people that makes certain addons? do they have some contact page? addons: viewforum.php?f=31

or is there some central forum site they check often?
There is also this forum: viewforum.php?f=8 (most addons have a topic there)
needmoreplayers
Posts: 67
Joined: November 17th, 2023, 7:33 pm

deleted dont care about all the problems of this game anymore

Post by needmoreplayers »

deleted dont care about all the problems of this game anymore
Last edited by needmoreplayers on January 9th, 2024, 8:09 pm, edited 2 times in total.
dwarftough
Posts: 484
Joined: August 4th, 2019, 5:27 pm

Re: bug?

Post by dwarftough »

needmoreplayers wrote: November 21st, 2023, 12:28 am - had an era
- had a map
- turned this off

and it kept turning on when in game

no idea what is the cause of it

not sure if it was the map or era, or combination of both or what


if i see that problem again ill edit/update this comment/reply

no idea whos maker or makers of this one
There is such a problem when one faulty mod may break the mod selection menu. But afaik this one is not the one. Some Corpse mod (they are several) afaik was one of such faulty mods, there were others as well. The issue was reported to the devs here https://github.com/wesnoth/wesnoth/issues/6780
Co-founder and current maintainer of IsarFoundation, Afterlife Rated and overall Wesnoth Autohost Project
Developer and maintainer of my fork of World Conquest, Invincibles Conquest II
User avatar
Medusa117
Posts: 40
Joined: June 25th, 2021, 1:13 pm
Contact:

Re: Random Recruit mod

Post by Medusa117 »

Atreides wrote: November 5th, 2023, 10:17 pm Well I can't seem to find an extant thread so I'll start one just so I can rave: This is more fun than a box full of kittens! ^-^

P.S. Found a little problem with it.

Seems that for no reason I can think of it is limited to level 1 recruits only. Even default has L0 recruits and of course many addons have L2 recruits. I have not tried it with Age of Heroes but I suppose that would have the same recruits as default.

The thing is written 100% in lua but fortunately I was able to edit it anyways to simply remove the limit and when tested it works fine giving me L0 and L2 recruits also.

Here is my fix for anyone who wants it:

Code: Select all

local function init_era()
	if wesnoth.scenario.era then
		for multiplayer_side in helper.child_range(wesnoth.scenario.era, "multiplayer_side") do
			local units = multiplayer_side.recruit or multiplayer_side.leader or ""
			for _, unit in ipairs(split_comma(units)) do
				local unit_type = wesnoth.unit_types[unit]
				if era_set[unit] == nil and unit_type
                -- and unit_type.level == 1 
                then
					era_set[unit] = true
					era_array[#era_array + 1] = unit
				end
			end
		end
		era_set = nil  -- free up memory
	else
		era_array = {
			"Cavalryman", "Horseman", "Spearman", "Fencer", "Heavy Infantryman", "Bowman", "Mage",
			"Merman Fighter", "Elvish Fighter", "Elvish Archer", "Elvish Shaman", "Elvish Scout", "Wose",
			"Merman Hunter", "Orcish Grunt", "Troll Whelp", "Wolf Rider", "Orcish Archer",
			"Orcish Assassin", "Naga Fighter", "Skeleton", "Skeleton Archer", "Ghost", "Dark Adept",
			"Ghoul", "Dwarvish Guardsman", "Dwarvish Fighter", "Dwarvish Ulfserker", "Dwarvish Thunderer",
			"Thief", "Poacher", "Footpad", "Gryphon Rider", "Drake Burner", "Drake Clasher",
			"Drake Glider", "Drake Fighter", "Saurian Skirmisher", "Saurian Augur"
		}
	end
end
I merely commented out the and unit_type.level == 1 which was simple enough since how to comment out things is the first bit of lua I've learned. : )
Oh yeah this is in the main.lua file.
Did u manage to add more units from other eras?
Hier könnte Ihre Werbung stehen.
User avatar
Atreides
Posts: 1075
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: Random Recruit mod

Post by Atreides »

Medusa117 wrote: December 18th, 2023, 12:26 pm Did u manage to add more units from other eras?
No adding units from other eras is not a problem. The problem was that it didn't let you recruit level 0 units (e.g. walking corpses, golbins and vampire bats from the core) for some reason. It limited selection to only level 1 recruits from whatever era you were playing. The Ageless and Neverending eras both have tons of eras inside them so the selection when playing them is huge.

I have no idea why it was designed that way but I did post a patch that will remove the (unwanted) limit.
User avatar
Medusa117
Posts: 40
Joined: June 25th, 2021, 1:13 pm
Contact:

Re: Random Recruit mod

Post by Medusa117 »

Atreides wrote: December 18th, 2023, 7:08 pm
Medusa117 wrote: December 18th, 2023, 12:26 pm Did u manage to add more units from other eras?
No adding units from other eras is not a problem. The problem was that it didn't let you recruit level 0 units (e.g. walking corpses, golbins and vampire bats from the core) for some reason. It limited selection to only level 1 recruits from whatever era you were playing. The Ageless and Neverending eras both have tons of eras inside them so the selection when playing them is huge.

I have no idea why it was designed that way but I did post a patch that will remove the (unwanted) limit.
Yeah but how did u add units from other eras? That was my Question because i want to add more Units from other eras like Archaic etc
Hier könnte Ihre Werbung stehen.
User avatar
Atreides
Posts: 1075
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: Random Recruit mod

Post by Atreides »

Medusa117 wrote: December 19th, 2023, 10:27 am
Atreides wrote: December 18th, 2023, 7:08 pm
Medusa117 wrote: December 18th, 2023, 12:26 pm Did u manage to add more units from other eras?
No adding units from other eras is not a problem. The problem was that it didn't let you recruit level 0 units (e.g. walking corpses, golbins and vampire bats from the core) for some reason. It limited selection to only level 1 recruits from whatever era you were playing. The Ageless and Neverending eras both have tons of eras inside them so the selection when playing them is huge.

I have no idea why it was designed that way but I did post a patch that will remove the (unwanted) limit.
Yeah but how did u add units from other eras? That was my Question because i want to add more Units from other eras like Archaic etc
Oh I understand I think. If you want to add units from the excellent Archaic era I can recommend a addon called Custom Campaign. It lets you build your own faction with almost anything you want.
User avatar
Medusa117
Posts: 40
Joined: June 25th, 2021, 1:13 pm
Contact:

Re: Random Recruit mod

Post by Medusa117 »

Atreides wrote: December 19th, 2023, 4:51 pm
Medusa117 wrote: December 19th, 2023, 10:27 am
Atreides wrote: December 18th, 2023, 7:08 pm
Medusa117 wrote: December 18th, 2023, 12:26 pm Did u manage to add more units from other eras?
No adding units from other eras is not a problem. The problem was that it didn't let you recruit level 0 units (e.g. walking corpses, golbins and vampire bats from the core) for some reason. It limited selection to only level 1 recruits from whatever era you were playing. The Ageless and Neverending eras both have tons of eras inside them so the selection when playing them is huge.

I have no idea why it was designed that way but I did post a patch that will remove the (unwanted) limit.
Yeah but how did u add units from other eras? That was my Question because i want to add more Units from other eras like Archaic etc
Oh I understand I think. If you want to add units from the excellent Archaic era I can recommend a addon called Custom Campaign. It lets you build your own faction with almost anything you want.
Thanks, but that mod only works for mp or local not for an campaign like i want.

I want that with the Random Recruit mod also Units from other Eras are Recruitable. Random Recruits is as i know bound to the Era the Campaign Author has set for the campaign. I want to add more Recruits to the list.
Hier könnte Ihre Werbung stehen.
User avatar
Atreides
Posts: 1075
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: Random Recruit mod

Post by Atreides »

I believe a campaign loads units the same way as an era does. That means a campaign you devise can refer to any MP era that exists if and only if it contains a [resource] tag (as of 1.16). I just checked and the Archaic era you mentioned does not contain that so there is no way to use that era.
User avatar
Medusa117
Posts: 40
Joined: June 25th, 2021, 1:13 pm
Contact:

Re: Random Recruit mod

Post by Medusa117 »

Atreides wrote: December 19th, 2023, 10:34 pm I believe a campaign loads units the same way as an era does. That means a campaign you devise can refer to any MP era that exists if and only if it contains a [resource] tag (as of 1.16). I just checked and the Archaic era you mentioned does not contain that so there is no way to use that era.
Nad how do i add that resource to a campaign?
Hier könnte Ihre Werbung stehen.
User avatar
Atreides
Posts: 1075
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: Random Recruit mod

Post by Atreides »

The answers are all here:
https://wiki.wesnoth.org/AddonsWML
Post Reply