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?
MarkMcWire![]() Topic Opener |
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 addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing ![]() ![]() |
hessenfarmer![]() |
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. ![]() ![]() |
kaputtnik![]() |
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: ![]() ![]() |