TeamSurvivalXtreme / SXCollection

SXC (SurvivalXtreme map Collection) add-on for Wesnoth
GNU General Public License v2.0
5 stars 2 forks source link

SXC Slaughter WML errors about unstore_unit leader #33

Open stevecotton opened 6 years ago

stevecotton commented 6 years ago

During the AI turn, there are lots of warnings about

Invalid WML found: [unstore_unit]: variable 'leader' doesn't contain unit data

That seems to be from the code for limiting SXC bosses to a maximum of 30 recruits. While that limit wouldn't be right for Slaughter, the code needs updating. The warning seems to be caused that SXC_Slaughter.cfg doesn't assign the role "big_boss" to any leaders.

stevecotton commented 6 years ago

Affects SXC_Rush too, and probably many others

stevecotton commented 6 years ago

Although there is a bug causing these warning, all my comments about "big_boss" are wrong - that's set automatically for all AI sides in the normal SXC macros.

stevecotton commented 6 years ago

Thanks @Jordy-Jordan for the hint that it involves the fake-side's recruit. I think I now understand the bug, but IIUC it's one that affects the balance of all maps that have fake sides, even those that don't trigger the warning. So any fix to it (other than fixing it in a way that preserves the same behaviour) will need the maps to be rebalanced.

Suppose a fake side whose units are moved by AI 8. This side's recruitment is done during the "new turn" event, which doesn't have a side, but during which it seems $side_number can be 1. Then (again IIUC, I haven't debugged through this):

However, killing units on the fake side will decrement recruits_8, increasing the recruit limit for the normal boss of side 8. If the fake side is killed before recruiting 30 units then the warning won't be triggered, but the recruit limit for side 8 will still be increased.

Jordy-Jordan commented 6 years ago

Right, I've even tried to manually add a 10th side to substitute the fake side with this error Invalid WML found: [unstore_unit]: variable 'creeps' doesn't contain unit data

Jordy-Jordan commented 6 years ago

I also think the only way to fix it is to rebalance the maps

stevecotton commented 6 years ago

Okay, there's less problems than I thought.

The fake recruit code will set unit.role=fake_recruits, which means that they don't affect the recruit limits when killed. And this seems to be working, even for recruit events that caused a WML error.

Jordy-Jordan commented 6 years ago

Yeah, that should work

stevecotton commented 6 years ago

Sorry for forgetting that 10-side support isn't in yet, I've opened #38 for cleaning it up and merging it.

Jordy-Jordan commented 6 years ago

Was there a missing "=" in ) role fake_recruits} on line 1657 from SXC_unit_macros.cfg ?

stevecotton commented 6 years ago

No missing "=", it's the three-argument MODIFY_UNIT FILTER VAR VALUE macro.

Jordy-Jordan commented 6 years ago

thx