hugoking1
<b>Commander-in-Chief</b>
- 7/5/07
- 6,811
- 300
hiện đang tìm hiểu thêm, các cậu có thể đăng kí tham gia code, test hoặc đóng góp ý tưởng tại đây 
Việt Nam là 1 faction lớn của game, bắt đầu xây dựng kinh tế và lực lượng cùng thời gian với các faction khác là năm 1936. Mod dựa trên nền mod Black ICE 1.0 của TFH không dành cho WinXP.
Nên là liên bang Việt Nam ? Vì khi bắt đầu sẽ add các tỉnh của Cam và Lào vào luôn
Dự kiến thế này : xây dựng lực lượng đến khoảng cuối năm 1938, sau đó xung đột biên giới Việt - Thái xảy ra => chiến tranh. Xong ku Thái rồi thì có event + thêm tài nguyên, IC với tuyên bố giành lại lưỡng Quảng từ tay TQ. Sau đó vài tháng chiến tranh bùng nổ tại biên giới phía Bắc (TQ tuyên chiến
). Việt - Nhật hợp đồng tác chiến, 1 đánh từ Bắc xuống, người còn lại đánh từ phía Nam 
Hoặc trước khi có chiến tranh với TQ thì đánh Myanmar ? cơ mà đánh Thái chắc đủ rồi nhỉ ?
tài liệu hướng dẫn mod : http://forum.paradoxplaza.com/forum/showthread.php?613916-List-of-Modding-Help-Threads
Tài liệu (tiếng Anh)
Có tài liệu khác trong file .rar đính kèm
[spoil]
Events and decisions
New modding commands/modifiers in For the Motherland
This is a compilation of new modifiers and event triggers/commands that are newly available in For the Motherland. It is still incomplete and some of it needs further testing, but it's a start :)
[spoil]
Changelog:
- Updated with the 'undeclared_war' command. Thanks Devildread!
- Added the 'war' command and the syntax for the 'Aquire Territory' War Goal. Thanks GCZ!
- Added the 'add_wargoal' command.
- Added some triggers/commands from Dev Diaries. Thanks GCZ!
- Added the 'coup_by = FROM' command.
- Now the post has bold for the actual code and italic for the comments.
- Made some fixed here and there plus added a neat trick to the remove_minister command.
[/spoil]
How to create events for a specific date
[SPOIL]
IMPORTANT NOTE:
The method explained below is only necessary in Semper Fi and vanilla. The For the Motherland expansion solved the issue so now adding a simple 'date = yyyy.mm.dd' trigger will result in a very close triggering of the event.
Here's another dirty little hack to get around another limitation of the Clausewitz engine!
First, some introduction. The Clausewitz engine was made specifically for a long sandbox game where events are meant to be random. Hearts of Iron III is played in a much more confined timeframe so it is frequently required to have scripted events at a specific date. Creating such events is not as straightforward as it was in the old engine.
The Clausewitz uses a buffer to store the potential events that can be fired in the current month. In EU3 this is not an issue, since a month is a rather short amount of time, only 31 ticks at most. In HoI3, the shortest month is 28*24 = 672 ticks long. That's twice as many as days in a year! And things usually happened much faster in the 20th Century anyway.
Still, we are stuck with the buffer. Only events that were available at the first day of a month can be activated during that month. So, if you add a trigger like
then your event will fire on June 1st instead of May 12, because the event was not in the puffer during May.
Now, here's what you need to do to get around this:
Example:
[/SPOIL]
Army restructuring events
[SPOIL]
Here's a decision I made for the HPP mod to remove the battlecruiser Hiei from the map and place a new version in the build queue. This decision models reconstruction of the old WW1 era ships that was done by several countries during the late '30s.
And here's the OOB file that gets loaded:
The AI can't change names, but it may delete HQs on its own. It isn't possible to restrict players from renaming a unit. I haven't tried bug-checking the remove_brigade command, and didn't check if I gained MP when the Hiei was removed in the decision above. If all the brigades are removed then I would assume the division is deleted.
By "upgrade", do you mean the militia->infantry type of upgrade or the upgrade where you improve a unit's techs? If you meant the militia->infantry upgrade, then the AI can't use the feature and no event commands exist to force a unit to upgrade. The best you can do is use code like what I posted above.
If you meant upgrading techs, then that is in the production LUA file in the script folder.
[/SPOIL]
A Guide to Adding Buildings and Convoys to OOBs
[SPOIL]
Ever get tired of loading up as certain countries at the start and adding convoys to their build queues? Ever wanted to add forts via event but not go the lazy route and make the forts cost supplies or create an IC penalty modifier? Don't visit the HPP forum often enough to find the answers to those questions? Fear not, as TZoli figured out how to add convoys to OOB files, both those that are loaded via event or decision and those loaded when a scenario starts. Using his work I applied it to buildings as well.
So, here's what the code looks like for placing convoys in an OOB file:
And for buildings (fort used in this example):
The one problem is that the "size" variable doesn't work if you put a number greater than 1 there, and that's the variable that governs how many runs are in a serial build. Placing more than one building of the same type in the same province results in parallel builds there, but the game behaves correctly when the buildings finish construction. The building type is the last line, and the number you put there is the order in the list found in the file common/buildings.txt the building is in. So, an air base is building 1 since it's at the top, while industry is building 10 since it's the tenth one down.
This is pretty cool stuff for modders, as you can now have your Atlantic Wall type decisions actually place the defenses in the build queue and have them be completed in the correct locations.
[/SPOIL]
Interface
Example of changing the position of pictures in the event window
[SPOIL]
Look in eventwindow.gui in the interface folder. This is what i have entered, but you might need to tweak the position differently
[/SPOIL]
How to add countries
http://www.paradoxian.org/hoi3wiki/Adding_Countries
[/spoil]

Việt Nam là 1 faction lớn của game, bắt đầu xây dựng kinh tế và lực lượng cùng thời gian với các faction khác là năm 1936. Mod dựa trên nền mod Black ICE 1.0 của TFH không dành cho WinXP.
Nên là liên bang Việt Nam ? Vì khi bắt đầu sẽ add các tỉnh của Cam và Lào vào luôn

Dự kiến thế này : xây dựng lực lượng đến khoảng cuối năm 1938, sau đó xung đột biên giới Việt - Thái xảy ra => chiến tranh. Xong ku Thái rồi thì có event + thêm tài nguyên, IC với tuyên bố giành lại lưỡng Quảng từ tay TQ. Sau đó vài tháng chiến tranh bùng nổ tại biên giới phía Bắc (TQ tuyên chiến
). Việt - Nhật hợp đồng tác chiến, 1 đánh từ Bắc xuống, người còn lại đánh từ phía Nam 
Hoặc trước khi có chiến tranh với TQ thì đánh Myanmar ? cơ mà đánh Thái chắc đủ rồi nhỉ ?

tài liệu hướng dẫn mod : http://forum.paradoxplaza.com/forum/showthread.php?613916-List-of-Modding-Help-Threads
Tài liệu (tiếng Anh)
Có tài liệu khác trong file .rar đính kèm

[spoil]
Events and decisions
New modding commands/modifiers in For the Motherland
This is a compilation of new modifiers and event triggers/commands that are newly available in For the Motherland. It is still incomplete and some of it needs further testing, but it's a start :)
[spoil]
Mã:
EVENT TRIGGERS
[B]strategic_resource = <name>[/B] ([I]provincial/country scope[/I])
[B]has_strategic_resource = yes/no[/B] ([I]provincial scope[/I])
[B]has_wargoal = <tag>[/B]
[B]base_neutrality = x[/B] ([I]Checks base neutrality; the old [B]neutrality = x[/B] now checks effective neutrality![/I])
[B]has_removable_minister = yes/no[/B]
[B]surrender_progress = x[/B] ([I]Unlike the lost_national, this checks directly for surrender progress[/I])
[B]brigade_exists = <name>[/B] ([I]Checks if the brigade exists or not.[/I])
[B]brigade_in_combat = <name>[/B] ([I]Checks if said brigade is currently in combat.[/I])
EVENT COMMANDS
[B]strategic_resource = <name>/none[/B] ([I]provincial scope[/I], add a resource or remove the one there. If there's already one in the province, the new command will overwrite it.)
[B]do_election = <tag>[/B] ([I]immediately triggers an election in the country, regardless of government type[/I])
[B]remove_minister = <id> | yes | <position>[/B] ([I][B]id[/B] removes a certain minister, [B]yes[/B] removes one at random, [B]position[/B] removes the minister in a certain position; can't remove the HoS or HoG randomly, or at least they won't be removed right away, also if you remove a minister randomly from a position, he will be removed only from that position but will no longer be available for other positions either... BUT! If you do an "coup_by = THIS", it will remove the zombie minister from every positin he held before! The best part is that this won't even be displayed on the tooltip of the event![/I])
[B]war = {
target = TAG
attacker_goal = { casus_belli = cb_type_attacker }
defender_goal = { casus_belli = cb_type_defender }
}[/B] ([I]Starts a war betwen current country and TAG country with cb_type_attacker as the war goal of the current country and cb_type_defender for the TAG country. The possible war goals are in the '\common\cb_types.txt' file. If you start a war with the 'Aquire Territory' war goal, you will also need a '[B]region = "region_name"[/B]' argument after the 'casus_belli = cb_type'.[/I])
[B]add_wargoal = {
target = TAG
war_goal = { casus_belli = cb_type }
}[/B] ([I]Adds the 'cb_type' War Goal to the current country towards the target country. It won't start a new war, only works if there's already one in progress.[/I])
[B]undeclared_war = {
target = TAG
region = region_name
}[/B] ([I]Regions are defined in the '\map\region.txt' file. Note that the '\map' folder can only be replaced by mods in the mod folder, the extend command will cause the game to break on load.[/I])
[B]supplies = x[/B] ([I]Now also works in a province scope.[/I])
[B]fuel = x[/B] ([I]Now also works in a province scope.[/I])
[B]coup_by = FROM[/B] ([I]Changes the Ideology and Government Type of the current country to match that of FROM country. It will also change ministers if there are any applicable choices. Apparently it doesn't work with normal tags, only 'FROM'.[/I])
[B]remove_brigade = <name>[/B] ([I]Removes that brigade.[/I])
MODIFIERS
[B]threat_resistance = x[/B] ([I]lowers the threat generated against your country[/I])
[B]soft_attack = x
hard_attack = x
leader_defence = x[/B]
[B]sw_national_unity_effect = x[/B] ([I]strategic warfare national unity effect; the old modifier effects NU gain/loss from events, this effects gain/loss from strategic warfare[/I])
[B]jungle_effects = x[/B] ([I]reduces attrition/combat penalty from high temperature in humid terrain (not necessarely jungle, but very likely)[/I])
[B]winter_effects = x[/B] ([I]reduces attrition/combat penalty form low temperature[/I])
[B]amm_movement_speed = x
nuke_research = x
fuel_conversion = x[/B]
[B]air_intercept = x[/B] ([I]plus any other mission type[/I])
[B]land_build_speed = x
naval_build_speed = x
air_build_speed = x[/B]
[B]rocket_build_speed = x
tank_build_speed = x[/B]
HISTORY FILES
[B]money = x
energy = x
metal = x
rare_materials = x
crude_oil = x
fuel = x
supplies = x[/B]
NEW MODIFIERS IN buildings.txt
[B]damage_factor = x[/B] ([I]multiplies damage done to this building from bombing (and maybe from ground combat, I don't know)[/I])
[B]repair = yes/no[/B] ([I]determines if the building repairs on its own or not, used for underground cells[/I])
[B]show_for_province = yes/no[/B] ([I]determines if the province owner sees a picture of the building, used for undergrond cells[/I])
NEW STATIC MODIFIERS
[B]government_in_exile = {}[/B] ([I]Applies for every Government in Exile.[/I])
NEW IN defines.lua
[B]country[/B]:
[B]TECH_ABILITY_GAIN_DIVISOR[/B] ([I]determines the rate at which practical/theory gain is reduced[/I])
[B]PARTY_POPULARITY_CUTOFF[/B] ([I]you get one non-ruling-party position in your cabinet per this amount of opposition popularity[/I])
[B]COUP_CHANCE_PER_POSITION[/B] ([I]for every non-ruling-party position in the cabinet, you get this chance for a successful coup[/I])
[B]military[/B]:
[B]NAVAL_STACK_POS_PENALTY_MAX[/B] ([I]gives an upper limit to the positioning penalty from too much hull[/I])
[B]STATIC_AA_SCALE[/B] ([I]multiplies damage done by static AA[/I])
[B]SPAWN_PARTISAN_LIMIT[/B] ([I]minimum strength to spawn a partisan unit[/I])
[B]SPAWN_UNDERGROUND_LIMIT[/B] ([I]minimum strength to increase underground building level[/I])
[B]MAX_UNDERGROUND_DISTANCE[/B] ([I]max distance from capital/host's capital where you can build underground buildings[/I])
[B]UNDERGOUND_INITIAL_STRENGTH[/B] ([I]strength of the underground building when you place it[/I])
[B]UNDERGROUND_STRENGTH_GAIN[/B] ([I]base strength gained per day, actual value depends on distance from capital (host's capital for GiEs)[/I])
[B]UNDERGROUND_DETECT_CHANCE[/B] ([I]chance to detect an underground building[/I])
[B]UNDERGROUND_PARTISAN_STRENGTH[/B] ([I]??? needs testing, don't know what this does[/I])
[B]UNDERGROUND_SPAWN_STRENGTH[/B] ([I]strength lost when spawning a partisan unit?[/I])
[B]PARADROP_MIN_TIME[/B] ([I]delay between ordering and executing a Paradrop, in hours[/I])
[B]diplomacy[/B]:
[B]NAP_EXPIRY_ALERT_MONTHS_AHEAD[/B] ([I]you get an alert icon this many months before a NAP expires[/I])
[B]WARGOAL_ADD_COOLDOWN[/B] ([I]you need to wait this many months before adding a new war goal[/I])
[B]alignment[/B]:
[B]FACTION_STRAT_BONUS_DIST[/B] ([I]a country needs to be this close to a faction to share its strategic resources with its leader(majors?)[/I])
[B]FACTION_THREAT_DIST[/B] ([I]threat has an effect to this far from a faction (previously it only had an effect until the middle of the triangle, so it wouldn't push you into another corner, only to the center[/I])
Changelog:
- Updated with the 'undeclared_war' command. Thanks Devildread!
- Added the 'war' command and the syntax for the 'Aquire Territory' War Goal. Thanks GCZ!
- Added the 'add_wargoal' command.
- Added some triggers/commands from Dev Diaries. Thanks GCZ!
- Added the 'coup_by = FROM' command.
- Now the post has bold for the actual code and italic for the comments.
- Made some fixed here and there plus added a neat trick to the remove_minister command.
[/spoil]
How to create events for a specific date
[SPOIL]
IMPORTANT NOTE:
The method explained below is only necessary in Semper Fi and vanilla. The For the Motherland expansion solved the issue so now adding a simple 'date = yyyy.mm.dd' trigger will result in a very close triggering of the event.
Here's another dirty little hack to get around another limitation of the Clausewitz engine!
First, some introduction. The Clausewitz engine was made specifically for a long sandbox game where events are meant to be random. Hearts of Iron III is played in a much more confined timeframe so it is frequently required to have scripted events at a specific date. Creating such events is not as straightforward as it was in the old engine.
The Clausewitz uses a buffer to store the potential events that can be fired in the current month. In EU3 this is not an issue, since a month is a rather short amount of time, only 31 ticks at most. In HoI3, the shortest month is 28*24 = 672 ticks long. That's twice as many as days in a year! And things usually happened much faster in the 20th Century anyway.
Still, we are stuck with the buffer. Only events that were available at the first day of a month can be activated during that month. So, if you add a trigger like
Mã:
date = 1938.5.12
Now, here's what you need to do to get around this:
- Add only the year and month of the historical date into the 'trigger = {}' block, so the event will be put into the buffer. (Of course you will need to add every other requirement there as well, but don't use the exact date in this part!)
- Add a 'mean_time_to_happen = {}' block with 'days = 1' and a 'modifier = {}' block.
- The 'modifier = {}' block should look like this:
This way the chance of the event happening before the specified date will be very low. It still will be possible to get the event prematurely, but not with a significant chance.Mã:modifier = { factor = 99999 not = { date = specific_date_you_want } }
Example:
Mã:
country_event = {
id = 9990
is_triggered_only = yes
trigger = {
tag = GER
year = 1938
month = 9
}
mean_time_to_happen = {
days = 1
modifier = { factor = 99999 not = { date = 1938.9.29 }
}
title = "Munich Treaty"
desc = "Historical text"
picture = "law"
option = {
name = "Nice!"
}
}
Army restructuring events
[SPOIL]
Here's a decision I made for the HPP mod to remove the battlecruiser Hiei from the map and place a new version in the build queue. This decision models reconstruction of the old WW1 era ships that was done by several countries during the late '30s.
Mã:
diplomatic_decisions = {
reconstruct_hiei = {
major = yes
potential = {
tag = JAP
brigade_exists = "IJN Hiei"
not = { has_country_flag = "hiei_rebuilt" }
}
allow = {
not = { brigade_in_combat = "IJN Hiei" }
not = { has_country_flag = "washington_treaty" }
}
effect = {
remove_brigade = "IJN Hiei"
load_oob = "Units\IJNHieiReconstruction.txt"
set_country_flag = "hiei_rebuilt"
}
ai_will_do = {
factor = 1
}
}
}
And here's the OOB file that gets loaded:
Mã:
military_construction = {
country = JAP
battlecruiser ={ name = "IJN Hiei" historical_model = 7 }
cost = 1.50 #The engine will use practicals to determine the actual IC cost; this is just a placeholder
progress = 0
duration = 370
}
The AI can't change names, but it may delete HQs on its own. It isn't possible to restrict players from renaming a unit. I haven't tried bug-checking the remove_brigade command, and didn't check if I gained MP when the Hiei was removed in the decision above. If all the brigades are removed then I would assume the division is deleted.
By "upgrade", do you mean the militia->infantry type of upgrade or the upgrade where you improve a unit's techs? If you meant the militia->infantry upgrade, then the AI can't use the feature and no event commands exist to force a unit to upgrade. The best you can do is use code like what I posted above.
If you meant upgrading techs, then that is in the production LUA file in the script folder.
[/SPOIL]
A Guide to Adding Buildings and Convoys to OOBs
[SPOIL]
Ever get tired of loading up as certain countries at the start and adding convoys to their build queues? Ever wanted to add forts via event but not go the lazy route and make the forts cost supplies or create an IC penalty modifier? Don't visit the HPP forum often enough to find the answers to those questions? Fear not, as TZoli figured out how to add convoys to OOB files, both those that are loaded via event or decision and those loaded when a scenario starts. Using his work I applied it to buildings as well.
So, here's what the code looks like for placing convoys in an OOB file:
Mã:
convoy_construction=
{
country = TAG #put the 3 letter country tag here
id=
{
type=4713
}
size=1
cost=2.000 #you can put any number here and the engine will use it
progress=0.000
duration=0.000 #you can put any number here and the engine will use it
status=no #No means you get a convoy. Yes means you get an escort
}
And for buildings (fort used in this example):
Mã:
building_construction=
{
id=
{
type=4713
}
size=3 #doesn't work, but it seems that this line needs to be here and have a positive value that isn't zero
cost=5.0 #affected by practicals
progress=0.000
duration=180.000 #affected by practicals
location=1395
country="SOV"
building=4
}
The one problem is that the "size" variable doesn't work if you put a number greater than 1 there, and that's the variable that governs how many runs are in a serial build. Placing more than one building of the same type in the same province results in parallel builds there, but the game behaves correctly when the buildings finish construction. The building type is the last line, and the number you put there is the order in the list found in the file common/buildings.txt the building is in. So, an air base is building 1 since it's at the top, while industry is building 10 since it's the tenth one down.
This is pretty cool stuff for modders, as you can now have your Atlantic Wall type decisions actually place the defenses in the build queue and have them be completed in the correct locations.
[/SPOIL]
Interface
Example of changing the position of pictures in the event window
[SPOIL]
Look in eventwindow.gui in the interface folder. This is what i have entered, but you might need to tweak the position differently
Mã:
{
name ="event_images"
spriteType = "GFX_event_no_image"
position = { x= -513 y = -150 }
Orientation = "UPPER_RIGHT"
}
How to add countries
http://www.paradoxian.org/hoi3wiki/Adding_Countries
[/spoil]
Attachments
Chỉnh sửa cuối:


.
trong mod khi chơi Pháp, muốn release Việt Nam cũng ko đc vì nó có mỗi Indochina 
