Topic: Lua: plr:get_workers
kaputtnik![]() Topic Opener |
Posted at: 2021-03-09, 09:59
I want to write an Addon as win_condition which archives the goal of the Tempo training tournament. In short this win condition should archive Who creates the first hero wins the game. Or maybe Who creates the first x heroes wins the game. The problem is: I didn't found an easy way to get all workers/soldiers of a player. There is a function plr:get_workers() but this gives me only the number of workers, not instances of workers/soldiers. BTW: Looks like this function is not used anywhere. Do i overlook something? Can we have a function similar to plr:get_buildings() which returns a table of soldier objects? Then one can check the levels of each soldier. Edited: 2021-03-09, 10:00
![]() ![]() |
Nordfriese![]() |
Posted at: 2021-03-09, 10:45
Look at how it is done here: https://github.com/widelands/widelands/blob/master/data/campaigns/fri03.wmf/scripting/mission_thread.lua#L203-L217 +1 for adding a function to return all instances, open an issue for this please ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2021-03-09, 11:19
See: https://github.com/widelands/widelands/issues/4754 ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2021-03-10, 08:23
I have trouble to find out the max levels of soldiers. From my understanding Soldier description should give me for
The values for Is this a bug? ![]() ![]() |
Nordfriese![]() |
Posted at: 2021-03-10, 11:34
The property is called Why is ![]() ![]() |
hessenfarmer![]() |
Posted at: 2021-03-10, 12:24
If we go cleanup the documentation there are other issues in there as well. Shall we track them in the discussion of the branch or shall we open an issue to track them first. ![]() ![]() |
Nordfriese![]() |
Posted at: 2021-03-10, 12:40
I have already added the few I found to https://github.com/widelands/widelands/pull/4758/files#diff-151a692b2894cd9e863f4715863ba42785a85c7e4272474fc2f842a9faef6a44 Let's open an issue to track everything else ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2021-03-10, 14:39
Thanks a lot!
Yes, my fault. Was in hurry this morning. ![]() ![]() |