鋼鐵雄心4開發(fā)日志 | 10/20 模組制作改動(dòng)

牧游社 牧有漢化翻譯
HoI4 Dev Diary - Modding Changes
Archangel85, Oberbefehlshaber, Content Design, HoI4
Hello, and welcome back to another Dev Diary for No Step back and 1.11 Barbarossa. Today we will be pulling back the veil a bit and show you how modders can affect and use the new features coming in 1.11.
大家吼哇,歡迎閱讀新一篇絕不后退NSB與1.11版本號(hào)“巴巴羅薩Barbarossa”的開發(fā)日志。今天咱不整虛的,讓Mod制作者們瞅瞅如何調(diào)整和利用1.11版本號(hào)的新功能。
For those of you who do not get unreasonably excited by hearing about new script commands and changes to databases, the long and short of it is this: We made some fundamental changes to the way the game handles some things, which will probably require your favorite mods to spend some time updating. On the flip side, those changes also allow for some exciting possibilities down the line. If you came here hoping for a release date, we must ask you for just a little more patience. We promise the announcement is very close - but not today.
如果是對(duì)數(shù)據(jù)庫(kù)變化與新腳本指令沒(méi)有特殊感情的讀者,這篇文章總結(jié)來(lái)說(shuō)就是:我們?yōu)橛螒蛱幚砟承﹥?nèi)容的方式進(jìn)行了基礎(chǔ)性調(diào)整,所以大家最中意的Mod可能得花點(diǎn)時(shí)間更新。另一方面,這些改動(dòng)也為未來(lái)開發(fā)提供了一些機(jī)遇。如果你是為了發(fā)布日期而來(lái),那就請(qǐng)耐心稍等等。我們保證它就快來(lái)了,但不是今天。

Characters
人物
Probably the biggest change is in how we handle people on the backend (or ponies, for that matter - we do not discriminate). In the current live version, the game has no real concept of a person as a distinct thing. It only knows about country leaders, military leaders, political and military advisors, and operatives. Cases where a country leader could also be a general had to be handled manually, leading to lots of exciting bugs when the country leader was removed but the general was forgotten about and other such cases.
改動(dòng)最大的可能是在后臺(tái)處理人物(或小馬,沒(méi)有任何差別對(duì)待的意思)的方式了。在當(dāng)前版本里,游戲沒(méi)有真正意義上的人物概念。它只知道國(guó)家領(lǐng)袖、指揮官、政治或軍事顧問(wèn)和特工。同時(shí)還擔(dān)任將領(lǐng)的國(guó)家領(lǐng)袖必須得由后臺(tái)手動(dòng)處理,也就導(dǎo)致了很多刺激的bug:比如國(guó)家領(lǐng)袖被公審了但他這個(gè)將領(lǐng)卻沒(méi)事,以及其他類似情況。
We have overhauled that side of the game from the ground up with the introduction of characters. This should dramatically reduce the amount of potential zombie generals shambling around, which I am sure the non-zombie population will greatly appreciate.
我們?cè)诜矫孢M(jìn)行了全面重制,并引入了人物概念。這應(yīng)該能顯著降低僵尸將領(lǐng)的數(shù)量,相信非僵尸人群會(huì)心懷感恩。
Characters are defined in the common/character folder, and their definitions look like this:
人物定義腳本位于common/character文件夾中,其定義如下所示:

Every character is defined as a container for different roles they can fulfill, like General (corps_commander), Advisor, country leader etc. Due to technical concerns, Operatives remain their own thing. On the character level itself, things like name and gender are handled. This also means that character names can now be localised and you can refer to a character by ID instead of by name (this helps a lot with character names that have non-english characters in them - turns out this broke some triggers and effects).
每個(gè)人物都定義成裝有不同可擔(dān)當(dāng)職務(wù)的容器,比如將領(lǐng)(corps_commander)、顧問(wèn)、國(guó)家領(lǐng)袖等。出于技術(shù)考量,特工仍然保持原樣。在人物層級(jí)方面,主要處理的是姓名和性別等內(nèi)容。也就是說(shuō)終于能對(duì)人名進(jìn)行本地化了,而指代某人物可以通過(guò)其ID代碼進(jìn)行(這對(duì)很多名字里有非英文字符的人物大有幫助——因?yàn)樗麄兊拿滞鶗?huì)導(dǎo)致某些觸發(fā)器和效果出問(wèn)題)。

This also means that if a character is removed from play - say, through a purge - they are automatically removed from all roles that they could have, which makes such systems a lot easier to do script-side. It also means that if we wanted to allow Zhukov to become a country leader, we could simply add a country leader role for him in the character file, like this:
也就是說(shuō),如果游戲中某個(gè)人物被移除了(比如清洗掉了),他們可擔(dān)當(dāng)?shù)母黝惵殑?wù)也會(huì)移除該人物,讓這種機(jī)制在腳本編碼層面更容易進(jìn)行。如果我們想讓朱可夫成為國(guó)家領(lǐng)袖,可以直接在人物文件中給他加一個(gè)國(guó)家領(lǐng)袖職能,像這樣:

Or we could also add the role later on, via focus, event, decision... like we do here with Beriya:
或者我們也可后續(xù)添加職能,通過(guò)國(guó)策、事件、決議……就像這兒的貝利亞同志:

That means there is a lot less confusion and duplication of effort necessary when putting a character into a new role, since stuff like portraits, name etc. are already handled. A broken portrait only needs to be fixed in one place instead of five etc.
由于肖像、姓名等已經(jīng)統(tǒng)一處理了,這樣人物新增職能時(shí),可以大幅減少代碼帶來(lái)的混亂與重復(fù)運(yùn)作。比如肖像的錯(cuò)誤只需修正一處即可,不必跑五個(gè)位置挨個(gè)修正。
Once defined, characters are recruited in the country history file in order to be added to the game. As you can see in the first screenshot, you can use visible triggers for unit leaders to ensure they are not shown if you don’t want them to be.
人物在定義后,會(huì)在國(guó)家的history文件中招募進(jìn)游戲。如圖一所示,你可以給部隊(duì)將領(lǐng)使用可視觸發(fā)器,以此確保他們不會(huì)顯示。
Characters that can potentially become country leaders are made into country leaders using the promote_character effect, like so:
有可能成為國(guó)家領(lǐng)袖的人物,可以使用promotion_character效果來(lái)把他們?cè)O(shè)置成國(guó)家領(lǐng)袖,像這樣:

This is a clear departure from the practice in the live version of the game, where you would create a new country leader in that effect. The old script with create_country_leader and other such effects should still be working, but obviously you don’t get any of the advantages of the unified character system.
這與當(dāng)前版本的運(yùn)作方式顯然不同,現(xiàn)在游戲里是用promotion_character效果創(chuàng)造一個(gè)新的國(guó)家領(lǐng)袖。帶有create_country_leader和其它此類效果的舊腳本應(yīng)該還能繼續(xù)運(yùn)作,但肯定享受不到整體人物系統(tǒng)的好處。
So let's talk about some more things you can do with it!
咱們聊聊新內(nèi)容能做的更多事情!
You can set and check character flags for nefarious purposes:
你可以出于各類奇異目的,設(shè)置和檢定人物flag:

You can change the traits of advisors without having to make a whole new advisor:
你可以改變顧問(wèn)的特質(zhì),而不必新建一個(gè):

You can check if a character is a certain type of character:
你可以檢定一個(gè)人物是否為特定類別角色:

You can save the character as a variable to refer to them later, such as spamming debug messages in the console!
你可以把一個(gè)人物保存為變量以便稍后引用,例如在控制臺(tái)中發(fā)送一大堆測(cè)試信息!


tank designer
坦克設(shè)計(jì)器
Next, let's talk a bit about how the tank designer works on the backend. It shares a lot of concepts with the ship designer, such as modules and module slots. It does, however, work a little differently in some other, important aspects.
接著咱們來(lái)聊聊坦克設(shè)計(jì)器的后端運(yùn)作。它和艦船設(shè)計(jì)器概念上甚是相通,例如模塊和模塊槽位。但它在另外某些重要層面的運(yùn)作方式卻略有不同。
While the system pretends that there are only a handful of chassis (light, medium, heavy, super-heavy, amphibious, modern), this is not technically true. Instead, the system maintains a whole host of other, dynamically created chassis. This allows us to make sure that tank designs with the tank destroyer role actually go into tank destroyer battalions etc.
雖然說(shuō)整個(gè)系統(tǒng)會(huì)假設(shè)只有幾種坦克底盤(輕型、中型、重型、超重型、兩棲和現(xiàn)代),但嚴(yán)格來(lái)說(shuō)并非如此。實(shí)際上,這個(gè)系統(tǒng)還涵蓋了一大堆動(dòng)態(tài)創(chuàng)建的底盤,以此來(lái)保證設(shè)計(jì)出來(lái)的坦克殲擊車實(shí)際配給了坦殲營(yíng)等情況。
However, these dynamic chassis are still generated from the base chassis, so any changes to them will carry over.
不過(guò)呢,這些動(dòng)態(tài)底盤仍然源自于基礎(chǔ)底盤,所以后者的任何改動(dòng)都會(huì)延續(xù)到前者。
The roles are enabled and disabled on individual modules:
這些職能可以在單個(gè)模塊上啟用或者禁用:


For the unlock of new module categories, you can then use this on a module to unlock that category:
若要解鎖新的模塊類別,你可以用這個(gè)來(lái)進(jìn)行:


Railways
鐵路
Railways function a little differently from other buildings. While they are technically province buildings like forts, they are in reality closer to a building that connects two provinces. A railway line is effectively a series of two-province connections, and the lowest one in the chain determines the level of the railroad connection between two supply hubs.
鐵路和其他建筑相比就略有不同了。雖然它們確實(shí)和堡壘相似,都是省份建筑,但是鐵路的概念更像是連接兩個(gè)省份的建筑。一條鐵路實(shí)際上是一串“兩個(gè)省份的連接”。而這串“兩個(gè)省份的連接”中最低值決定了兩個(gè)補(bǔ)給樞紐之間的鐵路等級(jí)。
To make it easier to change and maintain the historical railway setup, we have added an option to draw railways into the nudger tool, which you can access by using the nudge command in the console.
為了更輕松地改變和維護(hù)歷史鐵路設(shè)定,我們?cè)趎udger工具里添加了一個(gè)繪制鐵路路線的選項(xiàng),如有需要,在控制臺(tái)輸入NUDGE命令即可。

The railway setup is in the supply menu in the nudger, and you can easily add new railway lines to the existing setup in this way. It took me about a week and a half to do the entire 1936 setup, including tracking down reference maps (with a lot of help from some of our testers).
鐵路設(shè)定在nudger工具的補(bǔ)給菜單里。你可以輕松地在現(xiàn)有的鐵路網(wǎng)內(nèi)添加新的鐵路線。我花了大概一個(gè)半星期來(lái)制作了整個(gè)1936年的鐵路設(shè)置,包括查了一大堆參考地圖(測(cè)試人員幫大忙了)
If you want to add railways through script, you have the build_railway effect. It gives you a lot of options, with the most basic one being to lay out the path one province at a time:
如果想通過(guò)腳本來(lái)添加鐵路路線,你需要有build_railway這個(gè)效果。這可以給你很多選擇,其中最基本的是逐個(gè)省份建造線路:

This is obviously a little cumbersome for longer railways, especially if you don’t really care about the exact path. For that, you have the option to define a start and an end province:
當(dāng)然這對(duì)長(zhǎng)距離鐵路來(lái)說(shuō)有點(diǎn)繁瑣,尤其是不太注重鐵路具體路徑的時(shí)候。為此,你可以直接選定鐵路的起始和終點(diǎn)省份。

The game will then automatically generate a path from one end to the other using advanced neural network-based self-learning algorithms that use blockchain (read: I have no idea how it works but this sounds impressive).
然后,游戲?qū)⑹褂没诟呒?jí)神經(jīng)網(wǎng)絡(luò)的區(qū)塊鏈自學(xué)算法自動(dòng)生成一條從一端到另一端的路線(注釋:我也不知道這咋運(yùn)作的,但聽起來(lái)好強(qiáng)大)。
If finding the province is too much work, or if you want to be somewhat dynamic, you can even use start and end states (also note that you can specify what level of connection should be built):
如果你感覺(jué)從省份級(jí)別繪制鐵路路線的工作量太大,或者說(shuō)你想整點(diǎn)不一樣的活,你甚至可以直接選定起始地區(qū)和終點(diǎn)地區(qū)(注意,你可以特定想建造哪種級(jí)別的鐵路路線)。

Note that you can't mix these, so you can't define a starting province and a target state for example.
不過(guò)注要意,以上兩類不能混在一起。比如不能給一條鐵路選定起始省份和終點(diǎn)地區(qū)。
There are also corresponding triggers like can_build_railway and has_railway_connection:
這里也有相應(yīng)的代碼,比方說(shuō)can_build_railway和has_railway_connection:

The first checks if a railway can be built between two locations, while the other checks if one such connection already exists.
第一個(gè)命令可以檢查這兩個(gè)地點(diǎn)之間能不能建造鐵路,另一個(gè)用來(lái)檢查是否已經(jīng)有了這樣的鐵路連接。
Finally, there is has_railway_level, which checks if the specified state has a railway line in it with the specified level:
最終,has_railway_level這條代碼,可以檢查指定的地區(qū)是否有某個(gè)等級(jí)的鐵路。


Miscellaneous new effects, triggers, modifiers
各種新的效果、觸發(fā)器和修正
In addition to the things described above, we have added a number of useful things that some of you might find useful:
除了剛剛說(shuō)的一大堆東西之外,我們還加入了一些你可能覺(jué)得有用的小玩意。
Building_cost_factor:?a new modifier that affects the construction cost of buildings. This takes the buildings from the 00_buildings file, so it should work with mods that add more buildings.
Building_cost_factor:新的影響建筑物建造花費(fèi)的因數(shù)。這個(gè)因數(shù)影響到在00_building文件中的建筑物,所以說(shuō)即使有別的增加建筑物的模組,它也能正常運(yùn)作。
Core_state scope list,?allowing you to run effects and triggers on a country’s core states:
Core_state作用域列表。這個(gè)可以保證你可以在一個(gè)國(guó)家的核心領(lǐng)土上運(yùn)行效果和觸發(fā)機(jī)制。
Add_equipment_to_stockpile effect?can now take a variant name to ensure that you add the right kind of equipment.
Add_equipment_to_stockpile效果現(xiàn)在可以用采用變種名稱,以保證你添加了正確種類的裝備。

That's all for today, I hope you enjoyed these little insights and we are all excited about what crazy things you will do with the new tools at your disposal.
這就是這次日志的所有內(nèi)容了,希望大家中意這些小玩意。很期待能看到各位用這些新工具能整出什么活。
翻譯:月蝕 人間面包
校對(duì):zzztotoso 三等文官猹中堂
歡迎關(guān)注UP主和主播小牧Phenix!
歡迎關(guān)注牧游社微信公眾號(hào)和知乎專欄!微信公眾號(hào)改版為信息流,歡迎【置頂訂閱】不迷路,即時(shí)獲得推送消息!
B站在關(guān)注分組中設(shè)置為【特別關(guān)注】,將會(huì)在私信內(nèi)及時(shí)收到視頻和專欄投稿的推送!
歡迎加入牧有漢化,致力于為玩家社群提供優(yōu)質(zhì)內(nèi)容!組員急切募集中!測(cè)試群組822400145!? ??