Alright thanks.
Should I add this despite the fact that it seems to work now?
Also if running the SetCVar in the first line, does that mean that the .lua file is a 1 liner? Sorry if this question is stupid, I am new to this.
Edit: I tested it multiple times and the thing seems to work flawlessly now.
The code looks like this:
Lua Code:
AdvancedLanguageSelector = {}
AdvancedLanguageSelector.name = "AdvancedLanguageSelector"
function AdvancedLanguageSelector:Initialize()
EVENT_MANAGER:RegisterForEvent(AdvancedLanguageSelector.name, EVENT_PLAYER_ACTIVATED, AdvancedLanguageSelector.OnPlayerActivated)
end
function AdvancedLanguageSelector.OnPlayerActivated()
EVENT_MANAGER:UnregisterForEvent(AdvancedLanguageSelector.name, EVENT_PLAYER_ACTIVATED)
SetCVar("language.2","en")
end
function AdvancedLanguageSelector.OnAddOnLoaded(event, addonName)
if addonName == AdvancedLanguageSelector.name then
AdvancedLanguageSelector:Initialize()
end
end
EVENT_MANAGER:RegisterForEvent(AdvancedLanguageSelector.name, EVENT_ADD_ON_LOADED, AdvancedLanguageSelector.OnAddOnLoaded)
Is this foolproof or is there anything else I need to change/check before uploading it?
(Yes I wanna upload it here to share my work with other people who might wanna play the game in the same way I do
)
Thanks Baertram and sirinsidiator for your help!!