Jump to content

Recommended Posts

would anyone know how to add names? because I added 

STRINGS.MOSSLINGNAMES =
{
    "Lil' Dude",
}

in the strings.lua and I also added 

#. STRINGS.MOSSLINGNAMES.1
msgctxt "STRINGS.MOSSLINGNAMES.1"
msgid "Lil' Dude"
msgstr ""

in strings.pot but nothing happens :(... I hope somebody can tell me what i'm doing wrong...

Adding new strings into STRINGS table does nothing until they are used somewhere.

Pigman prefab does (apart some tag optimization):

inst:AddComponent("named")
inst.components.named.possiblenames = STRINGS.PIGNAMES
inst.components.named:PickNewName()

Thus, try

inst:AddComponent("named")
inst.components.named.possiblenames = STRINGS.MOSSLINGNAMES
inst.components.named:PickNewName()

 

I have this code in my mossling.lua prefab

local function fn()
local inst = CreateEntity()
inst:AddTag("_named")
if not TheWorld.ismastersim then
return inst
end

inst:RemoveTag("_named")
inst:AddComponent("named")
inst.components.named:PickNewName()
inst.components.named.possiblenames = STRINGS.MOSSLINGNAMES

And still nothing happens. no crash, no nothing :(! Also, I copy and pasted strings.lua & strings.pot and put edited versions in my mod folder. Maybe i'm not supposed to that or I put them in wrong place? I put my strings.lua where my mod main is and I made an "language" folder to put my strings.pot in just like actual Don't Starve Together folder... Really hope this is fixable & thanks for helping :D!

2 minutes ago, SuperDavid said:

I have this code in my mossling.lua prefab


local function fn()
local inst = CreateEntity()
inst:AddTag("_named")
if not TheWorld.ismastersim then
return inst
end

inst:RemoveTag("_named")
inst:AddComponent("named")
inst.components.named:PickNewName()
inst.components.named.possiblenames = STRINGS.MOSSLINGNAMES

And still nothing happens. no crash, no nothing :(! Also, I copy and pasted strings.lua & strings.pot and put edited versions in my mod folder. Maybe i'm not supposed to that or I put them in wrong place? I put my strings.lua where my mod main is and I made an "language" folder to put my strings.pot in just like actual Don't Starve Together folder... Really hope this is fixable & thanks for helping :D!

try putting possiblenames above PickNewName

I changed inst.components.named.possiblenames = STRINGS.MOSSLINGNAMES into inst.components.named.possiblenames = STRINGS.PIGNAMES and it immediately works with the pignames but not my custom STRINGS.MOSSLINGNAMES  names, maybe it's because I have only 1 name I need over 100 like the pigmen?! Dang, i'm so confused :?... 

Named:PickNewName() should handle only one name in the table just fine.

Try entering into the debug console: print(tostring(STRINGS.MOSSLINGNAMES));dumptable(STRINGS.MOSSLINGNAMES);
Does it print your names table? If it prints nil, then the table was not assigned properly. If it's set directly from modmain, GLOBAL.STRINGS.MOSSLINGNAMES may be needed.

When I did  print(tostring(STRINGS.MOSSLINGNAMES));dumptable(STRINGS.MOSSLINGNAMES); in game debug console nothing was printed back not even nil & I just added  GLOBAL.STRINGS.MOSSLINGNAMES  into my modmain and it crashes the game.

Files /strings.lua and /languages/strings.pot are ignored, they are not loaded at all. Only files in scripts folder can override game's lua files (and even then it should be used sparingly, to avoid incompatibilities with future versions of the game and other mods).

Put into modmain (anywhere after local STRINGS = GLOBAL.STRINGS, but not inside of GLOBAL.TheNet:GetIsMasterSimulation() check):

STRINGS.MOSSLINGNAMES =
{
    "Fried Chicken",
    "Lil' Dude",
	-- ...
}

 

Edited by Muche

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...