鋼鐵雄心4開發日誌 | 9/5 海軍將領特質與模組開發
來自專欄牧游社
44 人贊了文章
牧游社 牧有漢化翻譯
HOI4 Dev Diary - Modding and Traits
Podcat, Oberkommando HOI4
Hi everyone! Todays dev diary will be a 3 meal course. First we are going to be talking about the new admiral traits in Man the Guns, then we will be showing off some new modding toys, and finally there will be an extra dessert in the form of more modding stuff posted here in the modding forum. Hope its to your tastes ![]()
大家吼啊!今天的開發日誌將上三道菜。首先我們要介紹一波炮手就位Man the Guns里新的海軍將領特質,然後咱們要展示一些新的模組開發玩法,最後作為餐後甜點,我們要說一下在論壇Mod版塊上發布的一些與模組開發相關的內容。
Admiral Traits
海軍將領特質
With Man the Guns following Waking the Tiger and focusing on the naval aspects of the game we knew we wanted to give Admirals more progression and traits as well as new skills. Going over all the traits is going to be spoiling a bunch of upcoming stuff as well, so you will need to be patient with the details on some of that ![]()
因為炮手就位是在喚醒勇虎後發布的,並且著重關注遊戲的海軍方面,所以我們希望給海軍將領們帶來更多的改進和特質,當然還有新技能。梳理一遍全部特質會耽誤一大堆即將到來的新內容,所以你們得耐心地等待我們公布更多的細節。
We have expanded the single skill level of Admirals in a similar way to how we did Generals in WTT, so there are now 4 traits to better reflect their skills and personality: Attack, Defense, Manoeuvring and Coordination. Attack and Defense are pretty straight forward. Maneuvering is the more tactical skill that will matter for fleet positioning and movement while Coordination is the more organizational skill and affects missions and other things outside combat more. We』ll be covering these in more detail once we start breaking down fleets, task forces and combat.
我們擴展了海軍將領們原來單一的技能等級,就和我們在喚醒勇虎中對陸軍將領們所做的改動差不多,所以現在將有4個特質以更好地反映他們的技能和個性:攻擊Attack、防禦Defense、機動Manoeuvring和協同Coordination。攻擊和防禦兩個屬性比較直白。機動是一個比較戰術性的技能,它決定了艦隊的布署和運動。而協同則更像一個組織性的技能,它會影響任務的執行以及更多戰鬥之外的事情。我們會講述更多細節的,不過這要等到我們開始談論艦隊、特遣艦隊和海戰之後了。
Admirals will now get access to more earnable traits as well as personality traits. Some personality traits carry over from Generals, like Career Officer as well as new ones like Battleship Adherent. There are also assignable traits you can unlock and tailor your admirals. Finally there are terrain traits which are earnable and help in different naval terrain (see future diary for details). As admirals level up they gain 3 points across their skills for each level, more likely in their strong points. Every second level they also unlock the slots needed for assigned traits similar to how it works for generals. The assignable traits and admiral screen will be in Man the Guns while the base stuff like personality traits and earnable traits will be in the free patch. So just like with Waking the Tigers general traits.
海軍將領們有更多可獲得的特質以及個性方面的特質。有些個性特質是我們直接從陸軍那邊直接搬過來的,比如說職業軍官Career Officer,當然還有全新的特質比如巨艦狂熱者Battleship Adheren。還有一些可以分配的特質,在解鎖之後你就可以用它們來個性化你的海軍將領們了。最後還有一些地形特質,它們可以在不同的海洋地形幫中到你(詳細內容請關注後續開發日誌)。 每當將軍們升1級的時候,他們就會得到3個技能點,點數更容易增加到他們的強項技能中。將軍會每升2級將獲得一個可以用來分配特質的槽位,就和陸軍將領們一樣。可分配的海軍將領特質以及整個技能樹將被包含在炮手就位里,而個人特質以及獲得特質將會在免費更新中,就和喚醒勇虎里陸軍將領們的特質重做一樣。

Here is the whole trait tree:
這就是整個技能樹啦:

As you can see most traits will have dependencies on having earned traits first.
正如你所見,絕大多數特質都首先取決於先前已經獲得的特質。
There are stuff like Ironside if you want to focus on powerful capital ships, Air Controller for carrier abilities as well as things like Blockade Runner, Concealment Expert and Silent Hunter for raiders. There are also paths for improving the use of lighter ships under Flyswatter and Fleet Protector. This matters because light ships are going to get a whole lot more necessary for your fleets and naval operations.
關於海軍將領的特質,有可以讓你專心致志於強力主力艦的鐵人Ironside,為航母能力準備的制空專家Air Controller,還有為掠襲潛艇準備的穿越封鎖Blockade Runne、隱蔽專家Concealment Expert以及獵殺潛航Silent Hunter。還有一些可以幫助你更好地使用小型艦艇的,比如說蒼蠅捕手Flyswatter以及艦隊守護者Fleet Protector。這些特質也很重要,因為小型艦艇變得更加不可或缺,你的艦隊和海軍行動將要變得更加需要她們。
Modding!
模組開發!
Hello everyone! @shultays here. I am a programmer in HoI4 team and I have exciting updates for all our modders and for the players that enjoy their mods! In this dev diary I will introduce a couple new scripting features that will be especially appealing for our modders. It is a bit early for such tech dev diary but we wanted some feedback on those features, and also have enough time to iterate on such feedback.
大家吼啊!我是@shultays,是HOI4團隊中的一名程序猿,我這次給所有的Mod製作者和享受Mod的玩家們帶來了令人激動的更新!在這次開發日誌中我將會介紹一些新的腳本功能,這對我們的Mod製作者員們來說將是一個很賽艇的內容。這樣的技術開發日誌多少還是有點早,不過我們想要一點對於這些功能的反饋,以及擁有足夠的時間去根據反饋來調整。
I will give short descriptions and small examples here, more in-depth stuff can be found in my other post that I made in modding forums.
我在這裡會給出一些簡短的描述和一些小例子,而更深層次的東西在我發布在論壇Mod版塊上的另外一篇帖子里。
1. Arrays
數組
The people with programming experience are already familiar with the concept of arrays. For those who are not, arrays are basically containers of data. In HoI4, they are containers of variables (and things that can be stored as variables, such as states and countries).
有編程經驗的人們應該已經熟悉數組的概念了。不過對於那些還不熟悉的人,數組基本上來說是數據的容器。在HOI4里,它們是變數的容器(以及那些可以被作為變數儲存的東西,比如說省份和國家)。
Array support is an extension on the existing variable system. You can store arrays anywhere you can store variables (countries, states, unit leaders or globally). You can access individual array elements using existing effects & triggers that changes or compares variables (the syntax for accessing an element is array_name^index) or you can use them in the effects/triggers that accepts variables. And there are many additional effects and triggers to interact with arrays, like effects that can add/remove elements or triggers that can check for every or any elements.
數組支持是對於現有變數系統的一個擴張。你可以在任何你能儲存變數(國家、省份、領導人或者全局變數)的位置儲存數組。對於原先用來更改和比照變數的效果與觸發器,現在你能夠通過它們來訪問單個數組元素(用來訪問一個元素的句法是array_name^index),你也可以在接受變數的效果與觸發器中使用數組。同時將有更多的效果與觸發器能夠和數組進行交互,比如說有的效果可以增加/移除元素,或者說可以檢查每一個或任意一個元素的觸發器。
Lets give an example:
舉個栗子:
#create an example array with 3 countries, named "array_example"add_to_array = { array_example = GER }add_to_array = { array_example = ITA }add_to_array = { array_example = TUR }# calculate total pp of these 3 countriesset_temp_variable = { sum_pp = 0 }for_each_scope_loop = { array = array_example add_to_temp_variable = { sum_pp = political_power }}if = { # do they have more than 100 pp? limit = { check_variable = { sum_pp > 100 } } # remove 33 pp for_each_scope_loop = { array = array_example add_political_power = -33 } #pp spent, now do business}
Here I assumed Germany, Italy and Turkey made some kind of pact and I want to run an effect if they have more than 100 pp in total. This effects builds an array of 3 countries using add_to_array effect, calculates the sum of their pp by iterating on this array using for_each_scope_loop effect and removes 33pp from each if the sum is > 0 again using for_each_scope_loop.
這裡我假設德國、義大利、土耳其達成了某種同盟,並且我想要在他們總共擁有超過100點政治點數時啟動某種效果,那麼辦法是:使用add_to_array效果構建一個屬於這三國的數組,再通過使用for_each_scope_loop效果迭代此數組來計算其政治點數的總和,如果使用for_each_scope_loop之後結果再次大於0,則從各國中移除33點政治點數。
This is just one example to usage of arrays. There are many more ways to interact with arrays, which can be found in my other post.
這只是數組使用的一個例子。在我的其他帖子中還能找到許多與數組交互的方法。
In addition to arrays that you can create or change, the game will also support "game variable arrays". Similar to "game variables", in various scopes you will be able to access such constant arrays which are built using in game data. For example accessing "enemies" array in country scope will let you access enemies of a country. If you loop through enemies, you will loop every for every enemy of that country. Current list of game variables and arrays can be found in my other post, please check it if you are interested and feel free to post your suggestions.
除了可以創建或更改的數組外,遊戲還將支持「遊戲變數數組」。與「遊戲變數」類似,你將能夠在各個作用域中,訪問使用遊戲數據構建的此類常量數組。例如,訪問國家範圍內的「敵人」數組將允許您查看某個國家的敵人。如果你遍歷一遍這些敵人,你將查看一遍該國的每個敵人。如果你有興趣的話,可以在我的其他帖子中找到當前的遊戲變數和數組列表,請查閱一下它們,也隨時歡迎大家的建議。
2. Meta-Effects and Meta-Triggers
元效果和元觸發
This is something we borrowed from EU4, but the implementation and the usage is different. Meta-effects and meta-triggers will let modders to use non-dynamic effects/triggers (the ones that do not accept modifiers and can only use static tokens or constant values) as if they were accepting variables. It is hard to explain and so lets give an example! Consider following code:
這是我們從EU4借來的東西,但執行和使用方法不同。元效果和元觸發器將允許Mod作者像接受變數一樣使用非動態效果/觸發器(不接受修飾符量並且只能使用靜態標記或常量值)。這太難用人話解釋了,所以讓我們舉個例子!比如下方代碼:
add_equipment_to_stockpile = { type = infantry_equipment_2 amount = eq_amount}
In this effect, amount is dynamic and can be set using a variable (here it is being set to eq_amount variable). However this effect does not let scripters to use a variable as equipment type. You can not store infantry_equipment_2 in a variable and use it here.
在這個效果中,數量是動態的,可以使用變數來設置(此處設置為eq_amount變數)。但是此效果不允許腳本編寫者將變數用作裝備類型。你不能將infantry_equipment_2存儲在變數中並在此處使用它。
But with meta-effects anything is possible! Meta-effects will let scripters to use variables & scripted localization within their effect to build effects as if they were texts and run them. Now lets make previous effect accept equipment type and equipment level as variables stored in eq_type and eq_level.
但是使用元效果則一切皆有可能!元效果將讓腳本編寫者在其效果中使用變數化、腳本化的本地化語句來構建效果,就好像它們是文本一樣來運行。現在讓我們先前的效果接受裝備類型和裝備等級,後兩者作為變數存儲在eq_type和eq_level中。
set_temp_variable = { eq_type = 1 }set_temp_variable = { eq_amount = 10 }set_temp_variable = { eq_level = 2 }meta_effect = { text = { add_equipment_to_stockpile = { type = [EQ_TYPE]_[EQ_LEVEL] amount = eq_amount } } EQ_LEVEL = "[?eq_level|.0]" EQ_TYPE = "[This.GetEquipmentName]"}# scripted localizationdefined_text = { name = GetEquipmentName text = { trigger = { check_variable = { eq_type = 0 } } localization_key = "infantry_equipment" } text = { trigger = { check_variable = { eq_type = 1 } } localization_key = "artillery_equipment" } # give all equipment an index here}
Here we created a meta_effect that takes two arguments. These arguments will be used replacing the parameters ([EQ_TYPE] and [EQ_LEVEL]) inside the meta effect. EQ_LEVEL will be replaced by [?eq_level|.0] which is the integer value of eq_level (in this case 2.000 becomes 2). EQ_TYPE is a bit more complicated, it is being replaced by a scripted localization. This scripted localization will check eq_type variable and depending on its value it will return the key token for the equipment. If it is 0, it will return infantry_equipment. If two, it will return artillery_equipment.
這裡我們創建了一個帶有兩個參數的meta_effect。這些參數將用於替換元效果中的變數([EQ_TYPE]和[EQ_LEVEL])。EQ_LEVEL將替換為[?eq_level|.0],它是eq_level的整數值(在這種情況下,2.000將變為2)。EQ_TYPE有點複雜,它被本地化的腳本取代。該腳本地化腳本將檢查eq_type變數,並根據其值返回裝備的檢驗標記。如果為0,則返回infantry_equipment。如果是2,它將返回artillery_equipment。
So the final result is [EQ_TYPE] is being replaced by "artillery_equipment" and [EQ_LEVEL] is being replaced by "2" and in the end our effect will be built as:
因此,最後結果是[EQ_TYPE]被「artillery_equipment」取代,[EQ_LEVEL]被「2」取代,最後我們的效果將被構建為:
add_equipment_to_stockpile = { type = artillery_equipment_2 amount = eq_amount}
which will give you 10 artillery_equipment_2! Now you might think that this is extremely convoluted way of giving 10 artillery_equipment_2. But it will be possible to use and replace meta_effects in the scripted_effects or scripted_triggers, so this convoluted parts will be only written once.
這將給你10個artillery_equipment_2!現在你可能會認為給出10個artillery_equipment_2的方法極度令人費解。但是這樣就可以在scripted_effects或scripted_triggers中使用和替換元效果,因此這個複雜的部分只會寫一次。
3. Dynamic Modifiers
動態修正
Currently our modifiers can only contain static values and you cant use variables in them. With dynamic modifiers, it will be possible add such modifiers to country and states. To keep things simple, we limited adding and removing dynamic modifiers only through effects, although some QoL improvements may be added in future.
目前,我們的修正只能包含靜態值,你不能在其中使用變數。如果使用動態修正,你就可以向國家和省份添加此類修正。為了簡單起見,我們限制其僅通過效果添加和刪除動態修正,儘管將來可能會添加一些QoL改進。
Their declaration is similar to static modifiers, except that they will accept variables as modifier values.
它們的聲明文本與靜態修正類似,但是將接受變數作為修正值。
dynamic_modifier_example = { political_power_factor = pp_factor_variable}
And after declaring a dynamic modifier like that, you can run following effect to add this modifier to current scope.
在聲明了類似的動態修正之後,你可以運行以下效果來將此修正添加到當前作用域。
set_variable = { pp_factor_variable = 0.15 }add_dynamic_modifier = { modifier = dynamic_modifier_example }
This example will add "dynamic_modifier_example" dynamic modifier to the country of the scope. This modifier will give country pp gain factor equal to "pp_factor_variable" stored that in country. In this example we stored, 0.15 so the country will get 15% more pp gain. When you change the value of pp_factor_variable later through another effect, the bonus the country gets will also be updated.
這個例子將」dynamic_modifier_example」動態修正添加到作用範圍內的國家。這個修正將使國家的政治點數增長係數等於存儲在國家上的「pp_factor_variable」。在這個例子中,我們存進去了0.15,因此該國將獲得15%的政治點數增長加成。當你稍後通過另外一個效果更改pp_factor_variable的值時,該國的加成也將隨之更新。
Additionally you can define a scope while adding dynamic modifiers. In that case the modifier will fetch the variables from the scope that you specified. This will also let scripters to add multiple instances of same dynamic modifier that is targeting different countries (or states) so you can use them as if they were relationship modifier.
另外,你可以在添加動態修正的時候定義一個作用域。意味著修正將會從你制定的某個域里選取變數。腳本編寫者可以同時添加針對不同國家(或省)不同的多個相同動態修正,以便你將它們當作關聯修正來使用。
While adding modifiers, you can specify a duration as well, which makes them automatically removed after certain number of days. And it is possible to define a trigger, which will also remove the modifier when the trigger is false.
在添加修正條目時,你可以一併確定持續時間,讓修正在數天之後自動移除。同時也可以確立一個觸發器,當不滿足觸發條件的時候便會移除修正。
It will be possible to give dynamic modifiers icons. In that case they will show up in GUI. For example dynamic modifiers that are added country will show up if they were "national spirits" if an icon is defined.
你將能給動態修正附以圖標。這樣它們就可以在圖形界面里顯示出來了。舉一個例子,一個動態修正如果是以「國家精神」添加的,且它又有定義圖標的話,那麼便會顯示在國家界面里。

In this example Turkey has two dynamic modifiers in it. And we defined an icon here so it shows up in national spirits list. Both of these dynamic modifiers are same but one is targeted at Italy and the other one is target at France and value of "Fuel Capacity" is being read from those scopes (and root is Turkey, you can use targeted variables if you want). Also the effect that added those modifiers defined a duration, and these modifiers will be removed in two days because of that.
這個例子里的土耳其有兩個動態修正。而且我們為之定義了圖標,所以它會出現在國家精神欄里。這兩個動態修正都是一樣的,但一個的作用目標是義大利而另一個是法國,同時「燃油上限」的值是從該作用範圍中讀取的(源頭是土耳其,如果你想的話也可以添加指定目標的變數)。另外,添加這些修正的效果同時確定了一個持續時間,然後這些修正就會在兩天內結束。
4. More Scripted-GUI features
更多腳本編輯的圖形界面內容
Modders are being extremely creative with this feature and I am delighted to see all those new cool mods that is being developed or in the workshop. Other than fixing some unfortunate bugs and insights in the live version, we are also adding "dynamic lists" support for scripted GUIs.
模組作者在這方面非常具有創意,我也很高興看到工坊里那些開發出來的特別酷的新Mod。除了修改了一些直播版本中不幸出現的Bug和一些細節,我們也加入了「動態列表」機制來支持腳本編輯圖形界面。
Dynamic lists will let modders to create their own lists and fill those lists using an array they specify. In an older dev diary, I showed this sneak peek:
動態列表讓模組作者們能夠創作屬於自己的列表,並以他們自定義的數組來填滿列表。在以往的開發日誌里我也給各位偷偷展露了一點相關內容。
This one is actually implemented using arrays. Each cell here is dynamically created using an array of 64 elements and value of each element represents the cell state. Each cell element is being built using the scope and the value of the the array element.
這一項是通過數組來實現的。每一個單元格都是通過有64個元素的數組動態生成的,每一個元素的值代表單元格的狀態。每一個單元格內的元素都是使用特定域及數組元素中的值來建立的。
Another, more down to earth, example:
另外一個,更切實的例子:

Bottom list is populated using allies of the country (using "allies" game array in country scope). For Germany, this array has two elements, Italy and Turkey and thus it creates two entries in the bottom list. While building the elements of the bottom list, it changes scope to each entry in the element (if the element is not scopable, there are ways to access the value & index of the element, which are also being shown in the example)
底端列表是以目標國家的盟友填充的(在國家域里使用「盟友」數組)。對德國來說,這個數組有兩個元素,義大利與土耳其,因而在底端列表創造了兩個條目。在建立底部列表的因素時,它會將定義域指向元素中的每個條目(如果該元素是不可被域指向的,也有其他方式來導向該值與指數,這也在例子里展示了)。
Top list is built using an array that is stored in country scope and initially it is empty. Pressing "Add Item" button at top calls an effect that adds random country to that array, which also updates the list itself.
頂部列表是以儲存在國家定義域里的數組建立的,最開始是空白狀態。點擊頂部的「添加內容」按鍵會將隨機國家添加進該數組,並且也會自動更新列表本身。
The medium flags that are being shown as a grid is also another dynamic list. This example is given to show that the lists inside lists also possible.
這些展示出的作為網格的中等大小旗幟,也是另一個動態列表。這些例子是為了表明列表中的列表是可以做到的。
And that is all from me for now. If you are interested more on those topics, check the in-depth topic on modders forum and please give feedback.
我差不多就說這麼多啦。如果你對更多相關內容感興趣的話,請在論壇Mod板塊里查看深度解析的帖子,並請給出自己的反饋哦!
翻譯:一隻走地雞 子炎君 zzztotoso
校對:萬豪頓 三等文官猹中堂
歡迎關注鬥魚主播小牧Phenix!
歡迎關注牧游社微信公眾號和知乎專欄!微信公眾號近期改版為信息流,歡迎置頂訂閱不迷路,即時獲得推送消息!
歡迎加入牧有漢化,致力於為玩家社群提供優質內容!翻譯人員募集中!
推薦閱讀:
※如何評價歐陸風雲4新DLC《達摩》 (Dharma)?
※如何評價P社的新遊戲Surviving Mars?
※p社遊戲能有多魔幻?
※如何評價p社發行的BATTLETECH?
※睿智的p社玩家歷史一定比較好嗎?

