All,
I'm fairly advanced in creating a mod to automate trade. However, I'm stuck at 3 places:
ISSUE #1: Mod needs to cancel a trade route when certain conditions are met
- AI can cancel a route; likely though built-in function TradeRoute.Cancel
- Never figured out "how" to call a function from an event -OR-
- Cancel the route through an event / command
- There a create_trade_route; but there doesn't seem to be a cancel_trade_route
- I must have played with options / alternatives for hours AND looked at countless of examples; to no avail
Hopefully, I can add something prior to / inside / after the following to get the appropriate routes, then cancel
ISSUE #2: Mod needs to adjust level of a trade route when certain conditions are met
- Routes grow and shrink automatically: I want the mod to adjust the level
- Same than above, there seems to be a built-in function called TradeRoute.Level
(same sample code than above)
ISSUE #3: Variable not recognized when creating a route
- This is likely an obvious solution to most, but my skillset is limited
- For some reason, I cannot have the create_trade_route event recognize my level variable
- Everything works when I'm using a variable for the market; the direction or the goods
- Can't figure out why the level doesn't work.... VIC3 recognizes the route as Level 1; always
Any help would be greatly appreciated as the trade is killing the fun for me. I feel like I'm working: opening new routes; cancelling new routes; reopening new routes; and so on.
S
I'm fairly advanced in creating a mod to automate trade. However, I'm stuck at 3 places:
ISSUE #1: Mod needs to cancel a trade route when certain conditions are met
- AI can cancel a route; likely though built-in function TradeRoute.Cancel
- Never figured out "how" to call a function from an event -OR-
- Cancel the route through an event / command
- There a create_trade_route; but there doesn't seem to be a cancel_trade_route
- I must have played with options / alternatives for hours AND looked at countless of examples; to no avail
Hopefully, I can add something prior to / inside / after the following to get the appropriate routes, then cancel
Code:
every_trade_route = {
limit = {
goods = g:paper
exporter.owner = root
# placeholder for other limits
}
***is something here can be added to cancel the route***
}
ISSUE #2: Mod needs to adjust level of a trade route when certain conditions are met
- Routes grow and shrink automatically: I want the mod to adjust the level
- Same than above, there seems to be a built-in function called TradeRoute.Level
(same sample code than above)
Code:
every_trade_route = {
limit = {
goods = g:paper
exporter.owner = root
# placeholder for other limits
}
***is something here can be added to change the level of the route***
}
ISSUE #3: Variable not recognized when creating a route
- This is likely an obvious solution to most, but my skillset is limited
- For some reason, I cannot have the create_trade_route event recognize my level variable
- Everything works when I'm using a variable for the market; the direction or the goods
- Can't figure out why the level doesn't work.... VIC3 recognizes the route as Level 1; always
Code:
set_variable = {
name = level_test
value = 2
}
create_trade_route = {
goods = paper
level = var:level_test <==== creates a route at level 1; always
direction = import
target = c:PAP.market
}
Any help would be greatly appreciated as the trade is killing the fun for me. I feel like I'm working: opening new routes; cancelling new routes; reopening new routes; and so on.
S