Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
478 stars 77 forks source link

[LUA] Implement !GLOBAL_SET_BOBS equivalent #1689

Open kubaau opened 3 months ago

kubaau commented 3 months ago

S2 RTX files had the !GLOBAL_SET_BOBS command which enabled some special graphics for specific missions (examples). The correct object to display was not only based on what is in the WLD map but also depends on this setting. As far as I can tell, MapLoader::PlaceObjects does not work this way and there is no possibility to "tell it" to use a special set of graphics (is there?). This is problematic when porting S2 campaign maps which rely on !GLOBAL_SET_BOBS to, for example, place ruins instead of stalagmites or a tent instead of a shipwreck. For single objects this can be an easy fix using LUA's AddStaticObject but for many objects this becomes a massive pain, see this example from FANpaign chapter 3:

S2: Zrzut ekranu 2024-07-29 000825

RttR: Zrzut ekranu 2024-07-29 001850

Spikeone commented 3 months ago

Why is this required? The AddStatic and AddEnvObject functions do have a parameter for the file to tells which bobs to use, which is more reusable since you can use all bobs on one map instead of only one?

kubaau commented 3 months ago

Not required, just nice to have. I don't even know how to implement this yet. But I'm suggesting this from the perspective of porting existing maps. If such a feature was present it would be possible to automatically translate WLD+RTX into WLD+LUA for such maps without manually placing ruins and such. Currently when the WLD is interpreted with the "wrong" bobs the scripter needs to "fix" the map manually.