Equipment Trigger
You can find a list of equipment names here: https://hoi4cheats.com/equipment
For a super heavy battleship, the ID is sh_battleship
If you mean heavy cruiser, then the ID is heavy_cruiser
You can find a list of equipment names here: https://hoi4cheats.com/equipment
For a super heavy battleship, the ID is sh_battleship
If you mean heavy cruiser, then the ID is heavy_cruiser
-jordsta95
so if I wanted an event to trigger when you have 1 super heavy battleship, would it be:
has_equipment = { sh_battleship > 1 } or something different? I saw this on a website.
That would be checking for 2 or more, as you are saying greater than 1.
To have 1 (or more) you need:
has_equipment = { sh_battleship >= 1 }
That would be checking for 2 or more, as you are saying greater than 1.
To have 1 (or more) you need:
has_equipment = { sh_battleship >= 1 }
-jordsta95
I tried and I don't think the code works, either that or I messed up one of my focuses again. I am having that issue where some focuses are deleted but my focuses were working before I added the event. The error log shows this:
[18:17:28][database_scoped_variables.h:61]: invalid database object for effect/trigger: file: common/national_focus/420.txt line: 1078 democracy. use var:var_name to explicitly use variables in effects/triggers
[18:17:28][persistent.cpp:52]: Error: "Unexpected token: focus, near line: 2258" in file: "common/national_focus/420.txt" near line: 3029
[18:17:28][nationalfocus.cpp:1751]: BAD_submarines_ii: Couldn't find dependency BAD_submarines
[18:17:28][nationalfocus.cpp:1751]: BAD_naval_training: Couldn't find dependency BAD_admiral_training
[18:17:28][nationalfocus.cpp:1751]: BAD_big_ships_ii: Couldn't find dependency BAD_big_ships
[18:17:28][nationalfocus.cpp:1751]: BAD_improved_naval_doctrine: Couldn't find dependency BAD_naval_doctrine
[18:17:28][nationalfocus.cpp:1751]: BAD_extra_research: Couldn't find dependency BAD_support_equipment_2
[18:17:28][nationalfocus.cpp:1751]: BAD_extra_research: Couldn't find dependency BAD_infantry_equipment_2
[18:17:29][effect.cpp:292]: Error: "Unexpected token: =, near line: 19
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 20
[18:17:29][effect.cpp:292]: Error: "Unexpected token: =, near line: 24
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 25
[18:17:35][database_scoped_variables.cpp:114]: invalid database object for effect/trigger: sh_battleship. use var:var_name to explicitly use variables in effects/triggers
[18:17:35][database_scoped_variables.cpp:114]: invalid database object for effect/trigger: 1. use var:var_name to explicitly use variables in effects/triggers
[18:17:35][trigger.cpp:620]: Invalid trigger 'mean_time_to_happen' in events/BAD_baddie_events.txt line : 17
[18:17:35][trigger.cpp:620]: Invalid trigger 'timeout_days' in events/BAD_baddie_events.txt line : 18
[18:17:35][trigger.cpp:620]: Invalid trigger 'option' in events/BAD_baddie_events.txt line : 19
[18:17:35][trigger.cpp:480]: Error: "Unknown trigger-type: mean_time_to_happen, near line: 17
Unknown trigger-type: timeout_days, near line: 18
Unknown trigger-type: option, near line: 19" in file: "events/BAD_baddie_events.txt" near line: 33
[18:17:35][persistent.cpp:52]: Error: "Unexpected token: country_event, near line: 36" in file: "events/BAD_baddie_events.txt" near line: 67
[18:17:51][effect.cpp:292]: Error: "Unexpected token: =, near line: 19
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 20
[18:17:51][effect.cpp:292]: Error: "Unexpected token: =, near line: 24
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 25
[18:18:51][persistent.cpp:52]: Error: "Error reading division template (City Defence Army) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_0_0, near line: 4" in file: "history/units/BAD_1936.txt" near line: 4
[18:18:51][persistent.cpp:52]: Error: "Error reading division template (City Defence Army 2) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_1_0, near line: 23" in file: "history/units/BAD_1936.txt" near line: 23
[18:18:51][persistent.cpp:52]: Error: "Error reading division template (City Defence Army 3) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_2_0, near line: 42" in file: "history/units/BAD_1936.txt" near line: 42
That's not to do with the battleship. In the reward for the focus "Improve Citizens Lives" you have:
ideology = democracy
This should be
ideology = democratic
That's not to do with the battleship. In the reward for the focus "Improve Citizens Lives" you have:
ideology = democracy
This should be
ideology = democratic
-jordsta95
Hello, and sorry for messaging a lot, but I fixed the 'improve citizens lives' focus but I still have the same error. The error log did show less errors but there is still a lot of these "couldn't find dependency" errors. I have no idea what is causing them as it doesn't really tell me why, it just says it can't find the dependency.
[01:02:23][persistent.cpp:52]: Error: "Unexpected token: focus, near line: 2253" in file: "common/national_focus/420.txt" near line: 3045
[01:02:24][nationalfocus.cpp:1751]: BAD_submarines_ii: Couldn't find dependency BAD_submarines
[01:02:24][nationalfocus.cpp:1751]: BAD_naval_training: Couldn't find dependency BAD_admiral_training
[01:02:24][nationalfocus.cpp:1751]: BAD_big_ships_ii: Couldn't find dependency BAD_big_ships
[01:02:24][nationalfocus.cpp:1751]: BAD_improved_naval_doctrine: Couldn't find dependency BAD_naval_doctrine
[01:02:24][nationalfocus.cpp:1751]: BAD_extra_research: Couldn't find dependency BAD_support_equipment_2
[01:02:24][nationalfocus.cpp:1751]: BAD_extra_research: Couldn't find dependency BAD_infantry_equipment_2
[01:02:24][effect.cpp:292]: Error: "Unexpected token: =, near line: 20
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 21
[01:02:24][effect.cpp:292]: Error: "Unexpected token: =, near line: 25
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 26
[01:02:31][database_scoped_variables.cpp:114]: invalid database object for effect/trigger: sh_battleship. use var:var_name to explicitly use variables in effects/triggers
[01:02:53][effect.cpp:292]: Error: "Unexpected token: =, near line: 20
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 21
[01:02:53][effect.cpp:292]: Error: "Unexpected token: =, near line: 25
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 26
[01:03:18][effect.cpp:292]: Error: "Unexpected token: =, near line: 20
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 21
[01:03:18][effect.cpp:292]: Error: "Unexpected token: =, near line: 25
" in file: "history/countries/BAD - Baddie Empire.txt" near line: 26
[01:03:54][persistent.cpp:52]: Error: "Error reading division template (City Defence Army) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_0_0, near line: 4" in file: "history/units/BAD_1936.txt" near line: 4
[01:03:54][persistent.cpp:52]: Error: "Error reading division template (City Defence Army 2) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_1_0, near line: 23" in file: "history/units/BAD_1936.txt" near line: 23
[01:03:54][persistent.cpp:52]: Error: "Error reading division template (City Defence Army 3) for country ---.
The division_names_group refers to the unknown tag: BAD_DIV_2_0, near line: 42" in file: "history/units/BAD_1936.txt" near line: 42
I have tried fixing my events, checking all my spirits and focuses but everything looks normal, plus the error log doesn't exactly tell me what's wrong (also I suck with stuff like this..)
The dependency stuff is because you have focuses earlier in the file than the error, which have prerequisites of ones which appear after the error; meaning they are looking for focuses which the game doesn't know about, as it stopped loading the focus tree at the error.
The focuses causing the error are: "Improve Civilian Tech", "Improve Civilian Tech II", "Compacted Industry", "Faster Industry", and "Rocket Project" not having the final } after the "add_tech_bonus" reward.
Also the focus "Nuclear Project" needs looking at, as it is missing two } but also a category needs assigning to the first of the two tech bonuses.
When it comes to reading the error log you have to look at the file name, the line given, and what the error says.
So with:
[01:02:23][persistent.cpp:52]: Error: "Unexpected token: focus, near line: 2253" in file: "common/national_focus/420.txt" near line: 3045
Which is the first error that occurs; causing everything below to be "potentially an error, but who knows".
Unexpected token: focus - This means the word "focus" exists, but the game isn't expecting that.
in file: "common/national_focus/420.txt" - This is the file the error occurs in
near line: 3045 - The line number you need to be looking near (as a rule of thumb, look at the focus on that line, the one above, and the one after - line numbers are sometimes a little funky)
When opening that file, on line 3045 you see: y = 5
Not very helpful, so we look at the entire focus:
#Improve Civilian Tech
focus = {
id = BAD_improve_civilian_tech
icon = GFX_goal_continuous_non_factory_construct
x = 57
y = 5
cost = 10
search_filters = {
FOCUS_FILTER_INDUSTRY
}
prerequisite = { focus = BAD_build_civilian_industry_ii }
completion_reward = {
add_tech_bonus = {
bonus = 0.5
uses = 2
category = industry
}
}
First thing to look for is brace count (whether the number of { and } match up, and the } close off the right sections). This is usually the problem when looking at unexpected token errors.
If the brace count is correct, then you look at what the rewards/available/etc. are, to see if they could be an issue. e.g. if you are trying to add a building, but haven't selected a state to add it to.
And if everything there seems right, move to the focus above (repeat the above) and then the focus below (repeat above).
The dependency stuff is because you have focuses earlier in the file than the error, which have prerequisites of ones which appear after the error; meaning they are looking for focuses which the game doesn't know about, as it stopped loading the focus tree at the error.
The focuses causing the error are: "Improve Civilian Tech", "Improve Civilian Tech II", "Compacted Industry", "Faster Industry", and "Rocket Project" not having the final } after the "add_tech_bonus" reward.
Also the focus "Nuclear Project" needs looking at, as it is missing two } but also a category needs assigning to the first of the two tech bonuses.
When it comes to reading the error log you have to look at the file name, the line given, and what the error says.
So with:
[01:02:23][persistent.cpp:52]: Error: "Unexpected token: focus, near line: 2253" in file: "common/national_focus/420.txt" near line: 3045
Which is the first error that occurs; causing everything below to be "potentially an error, but who knows".
Unexpected token: focus - This means the word "focus" exists, but the game isn't expecting that.
in file: "common/national_focus/420.txt" - This is the file the error occurs in
near line: 3045 - The line number you need to be looking near (as a rule of thumb, look at the focus on that line, the one above, and the one after - line numbers are sometimes a little funky)
When opening that file, on line 3045 you see: y = 5
Not very helpful, so we look at the entire focus:
#Improve Civilian Tech
focus = {
id = BAD_improve_civilian_tech
icon = GFX_goal_continuous_non_factory_construct
x = 57
y = 5
cost = 10
search_filters = {
FOCUS_FILTER_INDUSTRY
}
prerequisite = { focus = BAD_build_civilian_industry_ii }
completion_reward = {
add_tech_bonus = {
bonus = 0.5
uses = 2
category = industry
}
}
First thing to look for is brace count (whether the number of { and } match up, and the } close off the right sections). This is usually the problem when looking at unexpected token errors.
If the brace count is correct, then you look at what the rewards/available/etc. are, to see if they could be an issue. e.g. if you are trying to add a building, but haven't selected a state to add it to.
And if everything there seems right, move to the focus above (repeat the above) and then the focus below (repeat above).
-jordsta95
Thanks for the help, that worked! There were some other focuses that were missing the { }, thanks for explaining what the dependency errors mean and I know I have been asking a lot of questions but I still do get 1 error with the sh_battleship event I have. It says in the log:
[18:12:09][database_scoped_variables.cpp:114]: invalid database object for effect/trigger: sh_battleship. use var:var_name to explicitly use variables in effects/triggers
My focuses are fixed however, but I haven't had the chance to test the event. Is this error to be worried about or would the event still work if I have this error?
(I Couldn't really test it beforehand because I needed a certian focuses but it kept getting deleted because of the old errors.)
Strange. Looking at the types of conditions you can check against, it may be better to use
has_navy_size = {
size > 0
type = capital_ship
archetype = ship_hull_heavy
}
This would be checking for a superheavy battleship (but it may also do a heavy battleships - not too sure)
It may be possible to do this too, but I'm not sure:
OR = {
has_equipment = {
SH_battleship_1 > 0
}
has_equipment = {
SH_battleship_2 > 0
}
has_equipment = {
ship_hull_super_heavy_1 > 0
}
}
This would account for all ships which have the model "super_heavy_battleship" - Though, I am not too sure if "has_equipment" works on the navy
xdAyden
I was wondering if there was anyway to make an event happen, but only if you have a certain amount of equipment. I was planning on making an event that triggers when you have 1 super heavy battle ship, but on the error log it says
[database_scoped_variables.cpp:114]: invalid database object for effect/trigger: heavy_battleship. use var:var_name to explicitly use variables in effects/triggers
I tried looking it up for quite a while, but couldn't find any answers to my question. Any Answer is appreciated.
(and yeah I have made a lot of forum posts, sorry for that)