Anbeeld / ARoAI

Anbeeld's Revision of AI, a mod for the grand strategy game Victoria 3
https://steamcommunity.com/sharedfiles/filedetails/?id=2880152075
MIT License
49 stars 14 forks source link

aroai_check_if_state_region_has_agriculture_resource error #6

Closed twdkeule closed 1 year ago

twdkeule commented 1 year ago

There is an error in the aroai_check_if_state_region_has_agriculture_resource function:

[12:02:06][jomini_script_system.cpp:263]: Script system error!
  Error: remove_building effect [ There is no building of type building_opium_plantation in state Tonga (624) ]
  Script location: file: common/scripted_effects; aroai_check_if_state_region_has_agriculture_resource line: 45 file: common/history/global/aroai_global.txt line: 2 file: common/scripted_effects; aroai_check_agriculture_resources_in_state_regions line: 53

at remove_building = $key$.

I suspet the first if is failing, but I dont know why. I am willing to fix this myself, but I have no idea how the if-limit check works. Can you point me in the right direction?

Anbeeld commented 1 year ago

This is not a real error in a sense that it doesn't affect gameplay, it's just a part of a hack used to check which arable resources are available in which states. The script that leads to the error takes a state that doesn't have a certain building and tries to create it there, then it checks if the building was actually created and if it's possible to add more levels to it, manipulates some variables if yes, and then without any conditions and checks tries to remove this artificially created building from the state, as ensuring that we actually removed it and no changes to gameplay happened is more important than some errors in the log when we get a lot of them anyways. Maybe I'm overly paranoid with Jomini at times, but it is what it is. You can probably remove the error by replacing remove_building = $key$ with if = { limit = { any_scope_building = { is_building_type = $key$ } } remove_building = $key$ }