Topic: Prefilled warehouse - how to do?

WidelandMonkey
Avatar
Topic Opener
Joined: 2025-09-29, 15:56 UTC+2.0
Posts: 3
Ranking
Just found this site
Posted at: 2025-09-29, 16:05 UTC+2.0

Hi everybody,

I'm just thinking about configuration of a prefilled warehouse for the empire tribe. Meaning: if it's finished builded, it instantly has a number of stones/wood/workers/etc.

How can this be solved? Are there any existing parameters for the lua files where this idea could be added? Or is there another way to solve this topic as an non-developer?

Thanks for developing this really nice game - much appreciate this so far... face-smile.png


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2871
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2025-09-29, 22:03 UTC+2.0

Hi WidelandMonkey,
welcome to our forums.
you might have a look at our scripting references. (Here)[https://www.widelands.org/documentation/autogen_map_object_programs/] you find how to call a script with an immovable Program. In this script you could use the lua function set_wares().
Not tested if this works, but it might be worth a try.


Top Quote
WidelandMonkey
Avatar
Topic Opener
Joined: 2025-09-29, 15:56 UTC+2.0
Posts: 3
Ranking
Just found this site
Posted at: 2025-09-30, 22:19 UTC+2.0

Does exists something like a trigger/event "finished building warehouse"? In case, this could be an opportunity to start the script "fill-up warehouse"... Didn't find anything like this...


Top Quote
tothxa
Avatar
Joined: 2021-03-24, 12:44 UTC+1.0
Posts: 541
OS: antix / Debian
Version: some new PR I'm testing
Ranking
One Elder of Players
Posted at: 2025-09-30, 23:04 UTC+2.0

Unfortunately no. You can only do that by starting a coroutine that regularly checks the player's warehouses.

Re @hessenfarmer's post: I don't think immovable programs are run for warehouses.

Edited: 2025-09-30, 23:05 UTC+2.0

Top Quote
WidelandMonkey
Avatar
Topic Opener
Joined: 2025-09-29, 15:56 UTC+2.0
Posts: 3
Ranking
Just found this site
Posted at: 2025-09-30, 23:23 UTC+2.0

Seems to be more complex than expected - as nearly always in development... :D Maybe I have to learn more about coding, especially with lua & co...


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48 UTC+1.0
Posts: 2710
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: Yesterday 08:11 UTC+2.0

If i am not mistaken a new warehouse sends a message to the inbox of a player. You may can check the players inbox for a corresponding message. The message contains the field (x/y coordinate) and with this information you can get access to the warehouse and use set_wares(), like hessenfarmer said.

In the future this might be easier if signals will be implemented.


Top Quote