Project Zomboid

Project Zomboid

Show Skill Xp Gain
Fragger 24 Jun, 2024 @ 11:18pm
修改文件以翻译|Modify the file for localization.
第一步-First step
找到此mod的本地文件-Find the local files for this mod.
  • 如果你有everything,可以直接搜索2313633950或者ShowSkillXpGain——如果你看不懂,可以忽略这句话
    If you have Everything, you can directly search for 2313633950 or ShowSkillXpGain —if you don't understand this, you can ignore this sentence.

  • 总而言之,你最后会在这个👇目录找到需要修改的文件。注意,替换开头的盘符为你的游戏文件所在的盘
    “X:\SteamLibrary\steamapps\workshop\content\108600\2313633950\mods\ShowSkillXpGain\media\lua\client”
    - In summary, you'll eventually find the file you need to modify in the directory below👇. Note, replace the drive letter at the beginning with the one where your game files are located:
    “X:\SteamLibrary\steamapps\workshop\content\108600\2313633950\mods\ShowSkillXpGain\media\lua\client”
第二步-Second step
修改文件并创建语言文件
- Modify the file and create the language file.
  • 用任何文本编辑器打开名为“ShowSkillXpGain.lua”的文件,将内容全部删除,将下方的内容复制粘贴到里面,然后保存并关闭
    - Open the file named "ShowSkillXpGain.lua" with any text editor, delete all the content, then copy and paste the content below into it, save and close the file.
    ShowSkillXpGain = ShowSkillXpGain or {} ShowSkillXpGain.showValue = true ShowSkillXpGain.invalidPerks = { "Strength", "Fitness", "Foraging" } local function isValid(perkName) local valid = true for k, v in ipairs(ShowSkillXpGain.invalidPerks) do if perkName == v then valid = false break end end return valid end local function ShowXP(player, skill, level) if skill ~= nil then local perkName = skill:getName() if not player:isNPC() then if isValid(perkName) then local showAmountString = "" if ShowSkillXpGain.showValue then showAmountString = string.format(" +%.2f", tostring(level)) end HaloTextHelper.addTextWithArrow(player, perkName .. showAmountString, true, HaloTextHelper.getColorGreen()) end end end end if ModOptions and ModOptions.getInstance then function ShowSkillXpGainOnModOptionsApply(optionValues) ShowSkillXpGain.showValue = optionValues.settings.options.showValue local tempTable = {"Foraging"} if optionValues.settings.options.strength then table.insert(tempTable, "Strength") end if optionValues.settings.options.fitness then table.insert(tempTable, "Fitness") end if optionValues.settings.options.sprinting then table.insert(tempTable, "Sprinting") end if optionValues.settings.options.sneaking then table.insert(tempTable, "Sneaking") end if optionValues.settings.options.lightfoot then table.insert(tempTable, "Lightfooted") end if optionValues.settings.options.nimble then table.insert(tempTable, "Nimble") end if optionValues.settings.options.melee then table.insert(tempTable, "Short Blade") table.insert(tempTable, "Long Blade") table.insert(tempTable, "Short Blunt") table.insert(tempTable, "Long Blunt") table.insert(tempTable, "Axe") table.insert(tempTable, "Spear") end if optionValues.settings.options.aiming then table.insert(tempTable, "Aiming") end if optionValues.settings.options.reloading then table.insert(tempTable, "Reloading") end if optionValues.settings.options.maintenance then table.insert(tempTable, "Maintenance") end ShowSkillXpGain.invalidPerks = tempTable end function ShowSkillXpGainOnModOptionsApplyInGame(optionValues) ShowSkillXpGainOnModOptionsApply(optionValues) end local SETTINGS = { options_data = { showValue = { name = getText("UI_ShowSkillXpGain_ShowValue"), default = true, tooltip = getText('UI_ShowSkillXpGain_ShowTheAmountOfXpGainedOrOnlyShowSkillNameAndGreenArrow'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, strength = { name = getText("UI_ShowSkillXpGain_HideStrength"), default = true, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, fitness = { name = getText("UI_ShowSkillXpGain_HideFitness"), default = true, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, sprinting = { name = getText("UI_ShowSkillXpGain_HideSprinting"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, sneaking = { name = getText("UI_ShowSkillXpGain_HideSneaking"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, lightfoot = { name = getText("UI_ShowSkillXpGain_HideLightfooted"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, nimble = { name = getText("UI_ShowSkillXpGain_HideNimble"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, melee = { name = getText("UI_ShowSkillXpGain_HideMelee"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXpGainsForTheseSkills'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, aiming = { name = getText("UI_ShowSkillXpGain_HideAiming"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, reloading = { name = getText("UI_ShowSkillXpGain_HideReloading"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, maintenance = { name = getText("UI_ShowSkillXpGain_HideMaintenance"), default = false, tooltip = getText('UI_ShowSkillXpGain_HideXPGainsForThisSkill'), OnApplyMainMenu = ShowSkillXpGainOnModOptionsApply, OnApplyInGame = ShowSkillXpGainOnModOptionsApplyInGame, }, }, mod_id = 'ShowSkillXpGain', mod_shortname = 'Show Skill Xp Gain', mod_fullname = 'Show Skill Xp Gain', } ModOptions:getInstance(SETTINGS) ModOptions:loadFile() Events.OnGameStart.Add(function() ShowSkillXpGainOnModOptionsApplyInGame({ settings = SETTINGS }) end) end Events.AddXP.Add(ShowXP)
  • 接下来,你需要返回上一级目录。注意,刚才修改文件的目录是:“……ShowSkillXpGain\media\lua\client”,返回上一级之后就是:“……ShowSkillXpGain\media\lua”
    - Next, you need to go up one directory level. Note, the directory where you just modified the file is: “……ShowSkillXpGain\media\lua\client”, going up one level brings you to: “……ShowSkillXpGain\media\lua”
  • Note, all steps from now on will use Simplified Chinese as an example, so if your language is not Simplified Chinese, all instances of "CN" should be replaced with the corresponding characters for your language. You can check the corresponding characters and file encoding for some languages at the bottom of the page linked[pzwiki.net] here. For example, Simplified Chinese corresponds to CN, and the encoding is UTF-8. Some languages use Cp1250, Cp1252... You need to save the language file with the corresponding encoding, otherwise, some characters may not display correctly in the game.
  • 在这里新建一个名为 “ shared ” 的文件夹,进入文件夹再次新建一个名为 “ Translate ” 的文件夹,再进入此文件夹新建一个名为 “ CN ” 文件夹
    - Here, create a new folder named "shared", enter this folder and create another folder named "Translate", then enter this folder and create a folder named "CN".
  • 进入 “ CN ” 文件夹,新建一个txt文件 “ UI_CN.txt ”。注意检查,此时的目录应该是这样的:“ ……ShowSkillXpGain\media\lua\shared\Translate\CN ”
    - Enter the "CN" folder, create a new text file named "UI_CN.txt". Make sure to check that the directory looks like this: “ ……ShowSkillXpGain\media\lua\shared\Translate\CN ”
  • 打开 “ UI_CN.txt ” ,复制下方的内容粘贴进去
    - Open "UI_CN.txt", copy and paste the content below into it.
    UI_CN = { UI_ShowSkillXpGain_SSXpGain = "经验值显示|Show Skill Xp Gain", UI_ShowSkillXpGain_ShowValue = "显示数值", UI_ShowSkillXpGain_ShowTheAmountOfXpGainedOrOnlyShowSkillNameAndGreenArrow = "显示获得的经验值<br>禁用则仅显示技能名与绿色箭头", UI_ShowSkillXpGain_HideXPGainsForThisSkill = "不显示此技能的经验值增长", UI_ShowSkillXpGain_HideStrength = "隐藏力量", UI_ShowSkillXpGain_HideFitness = "隐藏体格" UI_ShowSkillXpGain_HideSprinting = "隐藏冲刺", UI_ShowSkillXpGain_HideSneaking = "隐藏潜行", UI_ShowSkillXpGain_HideLightfooted = "隐藏轻巧", UI_ShowSkillXpGain_HideNimble = "隐藏灵活", UI_ShowSkillXpGain_HideMelee = "隐藏近战类", UI_ShowSkillXpGain_HideXpGainsForTheseSkills = "不显示此类技能的经验值增长", UI_ShowSkillXpGain_HideAiming = "隐藏瞄准", UI_ShowSkillXpGain_HideReloading = "隐藏装填", UI_ShowSkillXpGain_HideMaintenance = "隐藏维护", }
    然后就完成了,重载游戏LUA,打开设置查看就能看到翻译效果
    - Then you're done. Reload LUA, open the settings to see the translation effect.
  • Here is the English language file:
    UI_EN = { UI_ShowSkillXpGain_SSXpGain = "Show Skill Xp Gain", UI_ShowSkillXpGain_ShowValue = "Show Value", UI_ShowSkillXpGain_ShowTheAmountOfXpGainedOrOnlyShowSkillNameAndGreenArrow = "Show The Amount Of Xp Gained Or Only Show Skill Name And Green Arrow", UI_ShowSkillXpGain_HideXPGainsForThisSkill = "Hide XP Gains For This Skill", UI_ShowSkillXpGain_HideStrength = "Hide Strength", UI_ShowSkillXpGain_HideFitness = "Hide Fitness" UI_ShowSkillXpGain_HideSprinting = "Hide Sprinting", UI_ShowSkillXpGain_HideSneaking = "Hide Sneaking", UI_ShowSkillXpGain_HideLightfooted = "Hide Lightfooted", UI_ShowSkillXpGain_HideNimble = "Hide Nimble", UI_ShowSkillXpGain_HideMelee = "Hide Melee", UI_ShowSkillXpGain_HideXpGainsForTheseSkills = "Hide Xp Gains For These Skills", UI_ShowSkillXpGain_HideAiming = "Hide Aiming", UI_ShowSkillXpGain_HideReloading = "Hide Reloading", UI_ShowSkillXpGain_HideMaintenance = "Hide Maintenance", }
Last edited by Fragger; 24 Jun, 2024 @ 11:25pm
< >
Showing 1-6 of 6 comments
Fragger 24 Jun, 2024 @ 11:36pm 
如果没有看到设置就安装 Mod Options
我强烈推荐安装这几个mod来管理mod
Mod Manager
Mod Manager: Enhanced Load Order
Mod Manager: Load Order Sorter
Mod Comparer
:steamthumbsup:感谢大佬,我想再请问一下为什么隐藏体格和力量不管用
Fragger 8 Jul, 2024 @ 5:47am 
Originally posted by 不知所谓的机器:
:steamthumbsup:感谢大佬,我想再请问一下为什么隐藏体格和力量不管用
可能源代码这部分的功能失效了吧,等我有时间看看能不能修一下
Simple Show XP
大佬看看这个,貌似比这个更好
反正隐藏体格和力量可以用
Fragger 8 Jul, 2024 @ 6:02am 
Originally posted by 不知所谓的机器:
Simple Show XP
大佬看看这个,貌似比这个更好
反正隐藏体格和力量可以用
诶这个好像确实更好用的样子,而且作者说是基于这个mod改装的,有空马上试试
Fragger 10 Jul, 2024 @ 1:26am 
Originally posted by 不知所谓的机器:
Simple Show XP
大佬看看这个,貌似比这个更好
反正隐藏体格和力量可以用
试过了,功能更细,而且体格和力量都能隐藏
这是翻译文本:https://steamproxy-script.pipiskins.com/workshop/filedetails/discussion/3261721844/4414173228271597405/?ctp=2#c4414173425011471015
刚刚也更新进我这个汉化mod里面了:
https://steamproxy-script.pipiskins.com/sharedfiles/filedetails/?id=3261721844
Last edited by Fragger; 10 Jul, 2024 @ 1:26am
< >
Showing 1-6 of 6 comments
Per page: 1530 50