Topic: How can I iterate over all conquered player buildings, his tribe not know?
Forums » Player Forums » Technical Help » How can I iterate over all conquered player buildings, his tribe not know?
Posted at: 2021-07-30, 17:07
How can I iterate (in Lua) over all buildings from a player, his tribe not know.
don't work, if I search buildings that a player conquered in the game but are not part of his tribe.
I wouldn't iterate over all immovable object on map, because this takes a long time.
My widelands project: https://github.com/widelands/wl_addons_server/tree/master/addons/europeans_tribe.wadTop Quote
Posted at: 2021-07-30, 21:59
you may have a look at data/scripting/win_conditions/win_condition_functions.lua I used p.allowed_buildings there for this purpose.
Posted at: 2021-07-30, 22:52
Since only military buildings get conquered you may create a list of all military buildings of all players. And then compare the buildings owner.
For gathering military buildings names i've done similar in my auto_soldiers addon: https://github.com/widelands/wl_addons_server/blob/master/addons/auto_soldiers_cs.wad/init.lua#L188
Fight simulator for Widelands: