Issue with World Conquest selecting enemy commander from Ageless World Conquest directory

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

Moderator: Forum Moderators

Post Reply
Posts: 11
Joined: April 23rd, 2020, 2:27 am

Issue with World Conquest selecting enemy commander from Ageless World Conquest directory

Post by duuuuude »

So after uploading my add-on 'Ageless World Conquest' in 1.14 by Duuuude there is an issue that the standard (Default factions) World Conquest 2 is getting Ageless enemy leaders/commanders recruited. Although it is a different add-on, WC2 is reaching into AEWC2 and choosing ageless leaders for enemy.

SO there are two directories, from two different add-ons-


(enemy.cfg is where the enemy possible factions/leaders/commanders/recruits/recalls are listed. The Ageless one has Default+Ageless options available, and the Default one respectively only has the Default options available. Somehow WC2 is reaching into AEWC2 enemy and choosing for AI.)

they are intertwined via the file definition #define WORLD_CONQUEST_II_ERA_ENEMY_GROUPS (i guess, since it is the only tag/link in there)
which also appears in Wesnoth1.14\data\add-ons\(Ageless_)World_Conquest_II\utils\era\utilities\utilities.cfg
in the form of this code here

Code: Select all

And this in turn goes to some lua places- I found enemy_army in

So I thought to add the tags AE_ and ae_ before WORLD_CONQUEST_II_ERA_ENEMY_GROUPS and enemy_army thinking that might solve the problem. Instead I got the issue where line 262 from enemy.lua interacts with this code which I found in utilities.lua

Code: Select all

--wml array
function wc2_utils.pick_random_t(str)
	local size = wml.variables[str .. ".length"]
	if size ~= 0 then
		local index = wesnoth.random(size) - 1
		local res = wml.variables[str .. "[" ..  index .. "]"]
		wml.variables[str .. "[" ..  index .. "]"] = nil
		return res

SO..... after that my brain stopped working.. I have no idea how to fix this thing now....(by this thing I mean not the lua error, that is simple i removed the ae_ and it's fine, I mean Default WC2 going into AEWC2 directory and selecting Ageless leaders/commanders =/) HALP PLZ :augh:

At the moment anyone who wants to play DefaultWC2 will have to uninstall AEWC2 and play.. then reinstall when they want to load ageless version..

and the image of the error in game (that is the error of after when I added AE_ and ae_ tags to the definition/id names - the basic error is what I am trying to fix- it is when selecting WC2(original/default version) you get ageless commanders and leaders -.-)
Post Reply