Need help for the Mod "Random Recruits" and also some new mods needet
Moderator: Forum Moderators
Need help for the Mod "Random Recruits" and also some new mods needet
Hey folks,
i need some help for the Mod Random Recruits, i need every lvl 2 units name. As i see in the main.lua he uses the names for the recruitment. And if i dont think false with the names of lvl 2 unit they can also be recruitet randomly ofc
Also iam searching a mod that can give new units +1 damage or +1 attack random also for AI.
Also iam in search for a mod that can add benefits to units like they already exits ( at night more dmg ) but in a larger variety like in the Campagne Lotl
If u have any question just write me maybe u dont understand what i mean ( maybe because my english isnt thaaat good ^^ )
Kind Regards
i need some help for the Mod Random Recruits, i need every lvl 2 units name. As i see in the main.lua he uses the names for the recruitment. And if i dont think false with the names of lvl 2 unit they can also be recruitet randomly ofc
Also iam searching a mod that can give new units +1 damage or +1 attack random also for AI.
Also iam in search for a mod that can add benefits to units like they already exits ( at night more dmg ) but in a larger variety like in the Campagne Lotl
If u have any question just write me maybe u dont understand what i mean ( maybe because my english isnt thaaat good ^^ )
Kind Regards
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Something like https://github.com/ProditorMagnus/Oroci ... pes.lua#L5
It might not be up to date anymore, I focus on Ageless lists https://github.com/ProditorMagnus/WML_t ... a_lists.py
It might not be up to date anymore, I focus on Ageless lists https://github.com/ProditorMagnus/WML_t ... a_lists.py
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Thanks all units worked, but i need more xD also lvl 1-2.Ravana wrote: ↑February 5th, 2023, 9:13 pm Something like https://github.com/ProditorMagnus/Oroci ... pes.lua#L5
It might not be up to date anymore, I focus on Ageless lists https://github.com/ProditorMagnus/WML_t ... a_lists.py
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
So seemslike the AE units does not work but they are installed and also right in the script but he says that these units does not exits..Ravana wrote: ↑February 5th, 2023, 9:13 pm Something like https://github.com/ProditorMagnus/Oroci ... pes.lua#L5
It might not be up to date anymore, I focus on Ageless lists https://github.com/ProditorMagnus/WML_t ... a_lists.py
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
If you are trying to use ageless units, you need
[load_resource]
id=AE_required_events
[/load_resource]
Wesnoth does not let you access addons unless you declare you want to use them.
[load_resource]
id=AE_required_events
[/load_resource]
Wesnoth does not let you access addons unless you declare you want to use them.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Can you tell me how to add it so it woud work with Random Recruits? I want to try that mod with more Units
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
My main Goal is to add eras that i have installed to Random Recruits, so i have all units from all eras i want to be added to random recruits and use it in an sp campaign
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Code: Select all
[-- << RandomRecruits/main.lua
local wesnoth = wesnoth
local ipairs = ipairs
local gmatch = string.gmatch
local on_event = wesnoth.require("lua/on_event.lua")
local helper = wesnoth.require("lua/helper.lua")
local function split_comma(str)
local result = {}
local n = 1
for s in gmatch(str or "", "%s*[^,]+%s*") do
if s ~= "" and s ~= "null" then
result[n] = s
n = n + 1
end
end
return result
end
local era_array = {}
local era_set = {}
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","Bandit","Bone Shooter","Chocobone","Cuttle Fish","Dark Sorcerer","Deathblade","Dragoon","Drake Arbiter","Drake Flare","Drake Thrasher","Drake Warrior","Dread Bat","Duelist","Dwarvish Berserker","Dwarvish Pathfinder","Dwarvish Runesmith","Dwarvish Stalwart","Dwarvish Steelclad","Dwarvish Thunderguard","Elder Wose","Elvish Captain","Elvish Druid","Elvish Hero","Elvish Lord","Elvish Marksman","Elvish Ranger","Elvish Rider","Elvish Sorceress","Dune Sunderer","Fire Drake","Dune Swordsman","Goblin Knight","Goblin Pillager","Great Wolf","Gryphon","Gryphon Master","Javelineer","Knight","Lancer","Lieutenant","Longbowman","Mermaid Enchantress","Mermaid Priestess","Merman Netcaster","Merman Spearman","Merman Warrior","Dune Skirmisher","Dune Spearguard","Dune Explorer","Naga Warrior","Necrophage","Ogre","Orcish Crossbowman","Orcish Ruler","Orcish Slayer","Orcish Warrior","Outlaw","Pikeman","Dune Raider","Dune Scorcher","Red Mage","Revenant","Rogue","Dune Swiftrider","Saurian Ambusher","Saurian Oracle","Saurian Soothsayer","Shadow","Shock Trooper","Sky Drake","Swordsman","Dune Apothecary","Trapper","Troll","Troll Hero","Troll Rocklobber","Troll Shaman","Water Serpent","White Mage","Wraith",
}
end
end
if not pcall(init_era) then
local era_id = wesnoth.scenario.mp_settings and wesnoth.scenario.mp_settings.mp_era
or "default_era"
local msg = "Failed to load Era " .. era_id
wesnoth.wml_actions.message { caption = "Random Recruits", message = msg }
wesnoth.message("Random Recruits", msg)
wesnoth.wml_actions.endlevel { result = "defeat" }
init_era()
end
local era_unit_rand_string = "1.." .. #era_array
local function random_recruit()
return era_array[helper.rand(era_unit_rand_string)]
end
local function random_recruit_array(desired_length)
local result = {}
local set = {}
local attempt = 0
while attempt < 100 and #result < desired_length do
local unit = random_recruit()
if set[unit] == nil then
set[unit] = true
result[#result + 1] = unit
end
attempt = attempt + 1
end
return result
end
on_event("start", function()
local options = {
{
text = "Activate, make recruits random!",
image = "units/random-dice.png",
enable = true
}, {
text = "Deactivate, use standard recruits",
image = "misc/red-x.png",
enable = false
},
}
local label = "Activate RandomRecruits add-on?"
local result = randomrecruits.show_dialog { label = label, options = options, can_cancel = false }
result = options[result.index]
if result.enable then
for _, side in ipairs(wesnoth.sides) do
if #side.recruit > 0 then
side.recruit = random_recruit_array(3)
wesnoth.set_variable("RandomRecruits_enabled_" .. side.side, true)
side.gold = side.gold - 5
end
end
end
end)
on_event("prerecruit", function()
local side = wesnoth.sides[wesnoth.current.side]
if wesnoth.get_variable("RandomRecruits_enabled_" .. side.side) then
side.recruit = random_recruit_array(3)
end
end)
Hier könnte Ihre Werbung stehen.
- Atreides
- Posts: 1076
- 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: Need help for the Mod "Random Recruits" and also some new mods needet
That list of names is a fall back only. Whichever era you have loaded is the one it will use normally.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
If you want "Random Recruits" to use more than only level 1 units then remove the
unit_type.level == 1
check."If gameplay requires it, they can be made to live on Venus." -- scott
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Thank you for ur response but i want to add unit from other Eras. I already did remove the lvl cap.
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
Eras are multiplayer concept. If you start campaign from multiplayer menu you might have higher chance without having to change the addons from which you want to load units.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
So for an SP Campaign it does not work?
Hier könnte Ihre Werbung stehen.
Re: Need help for the Mod "Random Recruits" and also some new mods needet
You can create adjustments which let you achieve what you want, but it is probably not supported by default.
Last comment was mostly about getting around #ifdef MULTIPLAYER
Last comment was mostly about getting around #ifdef MULTIPLAYER