stuck1a Posted December 14, 2022 Share Posted December 14, 2022 (edited) Hi there, I have a map mod with multiple map directories. However, I would like to define my own collection of spawn points as several spawn regions, so I've added three more Map Directories which each represent one of such spawn regions. The spawn regions are displayed and basically works, but neither the description text nor the thumbnail are displayed in multiplayer. But it works fine in single player. I was at least able to translate the titles with a custom solution. But I guess, this should be possible by the core logic itself. This is my folder structure: map.info title=Green Zone lots=Muldraugh, KY description=Initial Description Green Zone fixed2x=true description.txt Übersetzte Beschreibung für grüne Zonen title.txt (1) Starte in einer grünen Zone objects.lua (shortened for better readability) objects = { { name = "", type = "SpawnPoint", x = 10916, y = 10133, z = 0, width = 1, height = 1, properties = { Professions = "all" } }, { name = "", type = "SpawnPoint", x = 10803, y = 10073, z = 0, width = 1, height = 1, properties = { Professions = "all" } }, { name = "", type = "SpawnPoint", x = 10919, y = 10132, z = 0, width = 1, height = 1, properties = { Professions = "all" } }, -- ... } spawnpoints.lua function SpawnPoints() return { unemployed = { { worldX = 36, worldY = 33, posX = 116, posY = 233, posZ = 0 }, { worldX = 36, worldY = 33, posX = 3, posY = 173, posZ = 0 }, { worldX = 36, worldY = 33, posX = 119, posY = 232, posZ = 0 }, } } end DebugServer_spawnregions.lua function SpawnRegions() return { { name = '(1) Green Zone', file = 'media/maps/GartenEdenSpawnsGreenZone/spawnpoints.lua' }, { name = '(2) Yellow Zone', file = 'media/maps/GartenEdenSpawnsYellowZone/spawnpoints.lua' }, { name = '(3) Red Zone', file = 'media/maps/GartenEdenSpawnsRedZone/spawnpoints.lua' } } end Rendered Result: ____________ My workaround to get at least the names translated I've added an file spawnregions.txt to my map mods Translate dir as follows: return { ['EN'] = { GreenZone = '(1) Start in a green zone', YellowZone = '(2) Start in a yellow zone', RedZone = '(3) Start in a red zone', }, ['DE'] = { GreenZone = '(1) Starte in einer gr\195\188nen Zone', YellowZone = '(2) Starte in einer gelben Zone', RedZone = '(3) Starte in einer roten Zone', } } And modified my DebugServer_spawnregions.lua as follows: function SpawnRegions() local activeLang = getCore():getOptionLanguageName() local sGreenZone = '(1) Start in a green zone' local sYellowZone = '(2) Start in a yellow zone' local sRedZone = '(3) Start in a red zone' local translationTable = {} if getActivatedMods():contains('GartenEdenMaps') then local file = getModFileReader('GartenEdenMaps', 'media/lua/shared/Translate/spawnregions.txt', false) if file then local scanline = file:readLine() local content = scanline and '' or 'return {}' while scanline do content = content .. scanline .. '\n' scanline = file:readLine() end file:close() translationTable = loadstring(content)() if translationTable[activeLang] ~= nil then sGreenZone = translationTable[activeLang].GreenZone or sGreenZone sYellowZone = translationTable[activeLang].YellowZone or sYellowZone sRedZone = translationTable[activeLang].RedZone or sRedZone end end end return { { name = 'Muldraugh, KY', file = 'media/maps/Muldraugh, KY/spawnpoints.lua' }, -- just as reference { name = sGreenZone, file = 'media/maps/GartenEdenSpawnsGreenZone/spawnpoints.lua' }, { name = sYellowZone, file = 'media/maps/GartenEdenSpawnsYellowZone/spawnpoints.lua' }, { name = sRedZone, file = 'media/maps/GartenEdenSpawnsRedZone/spawnpoints.lua' } } end So I was able to get this result: In singleplayer it looks like follows: (just borrowed image of bedford to ensure the image file isn't the problem) So what the heck do I wrong? Thanks in advance, stuck1a Edited December 21, 2022 by stuck1a prefixed [SOLVED] Pandorea 1 Link to comment Share on other sites More sharing options...
EasyPickins Posted December 15, 2022 Share Posted December 15, 2022 DebugServer_spawnregions.lua should look like this, where name is the map folder: function SpawnRegions() return { { name = 'GartenEdenSpawnsGreenZone', file = 'media/maps/GartenEdenSpawnsGreenZone/spawnpoints.lua' }, { name = 'GartenEdenSpawnsYellowZone', file = 'media/maps/GartenEdenSpawnsYellowZone/spawnpoints.lua' }, { name = 'GartenEdenSpawnsRedZone', file = 'media/maps/GartenEdenSpawnsRedZone/spawnpoints.lua' } } end Then add one folder for each map containing description.txt and title.txt to media/lua/shared/Translate/EN/ as you did in the translate/DE/ folder. media/lua/shared/Translate/EN/GartenEdenSpawnsGreenZone/title.txt would contain "(1) Green Zone" for example. stuck1a 1 Link to comment Share on other sites More sharing options...
stuck1a Posted December 21, 2022 Author Share Posted December 21, 2022 On 12/15/2022 at 8:11 PM, EasyPickins said: DebugServer_spawnregions.lua should look like this, where name is the map folder: function SpawnRegions() return { { name = 'GartenEdenSpawnsGreenZone', file = 'media/maps/GartenEdenSpawnsGreenZone/spawnpoints.lua' }, { name = 'GartenEdenSpawnsYellowZone', file = 'media/maps/GartenEdenSpawnsYellowZone/spawnpoints.lua' }, { name = 'GartenEdenSpawnsRedZone', file = 'media/maps/GartenEdenSpawnsRedZone/spawnpoints.lua' } } end Then add one folder for each map containing description.txt and title.txt to media/lua/shared/Translate/EN/ as you did in the translate/DE/ folder. media/lua/shared/Translate/EN/GartenEdenSpawnsGreenZone/title.txt would contain "(1) Green Zone" for example. How embarrassing... I could have figured that out myself, the Java code is pretty clear. Thanks a lot for your help! Now everything works as excepted. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now