• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
I.... like that map thing. Could be useful for my Trade League mod. A lot of people say that it is hard to find targets for the caravans.

I assume that, basically, it is a decision that add/remove revolt risk modifiers to every provinces based on some factors, then remove it with the event. Yours seem to have a lot of variations which complicated things, but if I only care about a "yes or no" map mod, i could just make a +1000% revolt and a -1000% revolt if X trigger is true to make it simple. And since there is a multiplayer condition available, it will prevent the world from burning.

I assume that there is a some lag when the button is pressed?
 
I.... like that map thing. Could be useful for my Trade League mod. A lot of people say that it is hard to find targets for the caravans.

I assume that, basically, it is a decision that add/remove revolt risk modifiers to every provinces based on some factors, then remove it with the event. Yours seem to have a lot of variations which complicated things, but if I only care about a "yes or no" map mod, i could just make a +1000% revolt and a -1000% revolt if X trigger is true to make it simple. And since there is a multiplayer condition available, it will prevent the world from burning.

I assume that there is a some lag when the button is pressed?
Yep. Since I want to display gradual changes I have first made sure that everything is flat 0%. But if you just want to display boolean, so to say, your suggestion would be the way to go. Just a big +% modifier for one end, and a big -% modifier for the other.
Actually the lag isn't that bad - though it was back when I did not hide the calculations behind a hidden_tooltip/hidden event. It lags really hard when the event option tries to display in its tooltip which provinces will experience a modifier change, that was bad ^^. But yeah if you hide the calculations, there isn't much lag.
 
Barely feel any lag, if any at all. I've even added a cost to the decision in-game, as a convenient gold sink!
Thanks for the clever idea.
MgwSzQE.jpg
 
Barely feel any lag, if any at all. I've even added a cost to the decision in-game, as a convenient gold sink!
Thanks for the clever idea.
MgwSzQE.jpg
Nice, happy to have helped :)
And even though I have a different approach to my mod than you, yours has also inspired me already. Nothing better than a bit of friendly competition to give you new ideas. We economy modders need to stick together, after all :cool:
 
using the current mod in the first post, manage to run from 867 to 891 before I got hit with a CTD. Occurred when I was readjusting goods for a province.

Only mods I used were CK2+ 4.06.4, the India expansions and Rex Teutonicorum 1.5 and this mod.

I can post the required stuff if you want me too, but since you make it sound like you're reworking the mod, not sure if I should.
 
using the current mod in the first post, manage to run from 867 to 891 before I got hit with a CTD. Occurred when I was readjusting goods for a province.

Only mods I used were CK2+ 4.06.4, the India expansions and Rex Teutonicorum 1.5 and this mod.

I can post the required stuff if you want me too, but since you make it sound like you're reworking the mod, not sure if I should.
No, I'm afraid the old mod is no longer compatible with the new versions. Sorry, but thanks for reminding me I'll have to put down the link.
Do not use the old version anymore.
 
Hi LordPeter, means we'll have to wait for CDT-2 or is there a still a working version available?

Regards.

Edit: Well, since i could not find any other download (despite the V1.0.0 on page 2) i assume it's no. Well, have to Wait, wait, wait then.
 
Last edited:
Hi LordPeter, means we'll have to wait for CDT-2 or is there a still a working version available?

Regards.

Edit: Well, since i could not find any other download (despite the V1.0.0 on page 2) i assume it's no. Well, have to Wait, wait, wait then.
Hi,
yes you need to wait for V2 I'm afraid, last version is not updated to the latest patch, and as Coom Cody says above, there might now be serious bugs.
But rest assured the new version is progressing, I might have a new dev diary up soon :)
 
Hi,
yes you need to wait for V2 I'm afraid, last version is not updated to the latest patch, and as Coom Cody says above, there might now be serious bugs.
But rest assured the new version is progressing, I might have a new dev diary up soon :)

As far as I am aware, it is still fairly stable (although the volcanoes don't always seem to give an extra plant). I have played 300+ years on 2.7.2 with only one CTD, and that was probably because I was messing with your mod. I have to say, I really like a lot of what it has, adds a great economy minigame that meshes well with the rest of the gameplay (actually making single province conquests much more reasonable in certain cases). But the deal with having EVERYTHING spawn on_action is awful, REALLY AWEFUL. When you have 8 or 10 provinces and you get 20 events to manage all your resources is such a pain, specially when you actually WANT to change some things around.

So I spent the last week trying to get a settlement_decision function for changing resources, and allowing the ai to use it. It works pretty well, but it takes a few years for the ai to get their provinces up and running at capacity.

Also your events are a real pain to read and edit, I wrote a bunch of scripted triggers to check if the provinces are able to produce a secondary or tertiary good, mainly for having a single location to change requirements, but it would also clean up the event scripts a lot;I haven't event attempted to replace all those checks.

Really, I just wanted to say Great Show, Awesome Job! (TM), and offer some suggestions.
(and if you are interested in any of the code, just ask!)
 
Last edited:
As far as I am aware, it is still fairly stable (although the volcanoes don't always seem to give an extra plant). I have played 300+ years on 2.7.2 with only one CTD, and that was probably because I was messing with your mod. I have to say, I really like a lot of what it has, adds a great economy minigame that meshes well with the rest of the gameplay (actually making single province conquests much more reasonable in certain cases). But the deal with having EVERYTHING spawn on_action is awful, REALLY AWEFUL. When you have 8 or 10 provinces and you get 20 events to manage all your resources is such a pain, specially when you actually WANT to change some things around.

So I spent the last week trying to get a settlement_decision function for changing resources, and allowing the ai to use it. It works pretty well, but it takes a few years for the ai to get their provinces up and running at capacity.

Also your events are a real pain to read and edit, I wrote a bunch of scripted triggers to check if the provinces are able to produce a secondary or tertiary good, mainly for having a single location to change requirements, but it would also clean up the event scripts a lot;I haven't event attempted to replace all those checks.

Really, I just wanted to say Great Show, Awesome Job! (TM), and offer some suggestions.
(and if you are interested in any of the code, just ask!)
Oh, wow!
First off, yeah while the idea was fun in my head, I was so focused on getting everything to work out in the first place, that I greatly neglected what you could call "player interaction".
So for the next version it is going to work as you said: Mostly via decisions. Only rarely you will get random events that force you to do sth (I was thinking e.g. to simulate deforestation, an event that removes "wood" and forces you to chose another tradegood).

Also, yeah back when I wrote V1 I basically had knowledge about a) portrait modding b) event modding, and nothing else. I started to learn about scripted triggers/effects and such during the development, but not everything was transferred to these. For V2, I currently have a lot of scripted triggers prepared that are not even used in events yet, and I think it will be far easier to maintain. You also should be able to figure stuff out a lot because I comment A LOT ;)

You really seem to know what you are doing btw! I actually considered asking you for the code right now; but so much has changed in the new version that I could not use it anymore. Basically, except for a few scripted_triggers I have coded everything from scratch.
But feel free to post your files if you want, so others could use them while they wait for V2

And if I need help later on I'll ask you :D
Btw, if you or anyone else has suggestions, things you would like to see, your local province's tradegood represented, your local volcano I forgot to add or something like that, feel free to post them :)

Edited to be finished, because my keyboard died mid-sentence...
 
Last edited:
Actually, I just started modding CK2 for the first time because of your mod! Most of the last week was doing simple little mods to understand the logic; like setting variables, flags and modifiers to different scopes, or figuring out how to move between scopes properly (and of course, what a scope actually is). Wasn't too hard, as I have been messing with EU4 code for a while.

Mostly this is just the scripted_triggers, two settlement_decisions and two maintenance events. There is about 1000 lines of code for the scripted trigger, but its just using your access triggers in the event chains, and four large triggers (two primary, two secondary) that is an OR verifying that it has a tradegood modifier and relevant possible trigger is no, or that it just any good of the tier can be produced. It's a lot of checks, so it probably slows the game down a bit. These are only really used in 2 places though. The first is to tell the ai to not do the decision if it has no possible choices, otherwise they would just waste prestige. The other is two are maintenance events which use them as their trigger to remove provinces with modifiers that no longer have access (MTTH of 3 months), as it no longer uses on_actions for maintenance (overwrites file with just one startup).

The main part is the decisions which are really simple lines of code that just fires the related province ping event at the location of the settlement. Nothing fancy, your code actually works perfectly for it already.

So this really isn't optimized, but it should function more or less the same. So for anyone who wants a copy to have decisions instead of on_action, feel free to throw this on top. As it is a mod for a mod, you will still need V1 (G1?) to use it. But really, I just want to give it to you; so you can see how it could be done so it would be easier for you to code (if you haven't already done it).

Oh, and I forgot couple suggestions. First of all, ancient Norse and Celts were known to use soap, not only as cleaning agent (Norsemen washed their hair and face daily), but also to bleach their hair and make it lighter (Celts did this to better dye their hair red, Suebi (Alemanni?) and Bavarians aswell). So I believe these cultural groups should not need tech requirements, and the feudal holding requirement should be any holding (maybe just no requirement? I don't know if nomads made soap or not). And the requirements should be fats/oils of any kind and a hydroxide, from either potash or burnt lime (which forms calcium hydroxide when dissolved in water, and may have been the original ancient material used to discover soap making). But I don't know if it would make sense that have this as a refined good (could also used to make cement) or just need a source of stone, or maybe pearls as well, as it can also be make from seashells. But this complaint(?) is just because I did a high school chemistry product where I made different soaps with different kinds of salts and fats.

A last suggestion, pick up the validator, because you have a lot of unnecessary ANDs; the default of any scope is an AND (validator told me this!), so I guess it is only really needed if you are within an OR.
 

Attachments

  • FPS_CTDplusDecisions.7z
    4,5 KB · Views: 5
Actually, I just started modding CK2 for the first time because of your mod! [...]
Indeed? I feel flattered now ^^
Mostly this is just the scripted_triggers, two settlement_decisions and two maintenance events. [...]
So this really isn't optimized, but it should function more or less the same. So for anyone who wants a copy to have decisions instead of on_action, feel free to throw this on top. As it is a mod for a mod, you will still need V1 (G1?) to use it. But really, I just want to give it to you; so you can see how it could be done so it would be easier for you to code (if you haven't already done it).
Thanks, I'll take a look. I reckon this could be of use for those people wanting to play V1 (still available in this tread somewhere, just not "officially" supported).
Oh, and I forgot couple suggestions. First of all, ancient Norse and Celts were known to use soap, not only as cleaning agent (Norsemen washed their hair and face daily), but also to bleach their hair and make it lighter (Celts did this to better dye their hair red, Suebi (Alemanni?) and Bavarians aswell). So I believe these cultural groups should not need tech requirements, and the feudal holding requirement should be any holding (maybe just no requirement? I don't know if nomads made soap or not). And the requirements should be fats/oils of any kind and a hydroxide, from either potash or burnt lime (which forms calcium hydroxide when dissolved in water, and may have been the original ancient material used to discover soap making). But I don't know if it would make sense that have this as a refined good (could also used to make cement) or just need a source of stone, or maybe pearls as well, as it can also be make from seashells. But this complaint(?) is just because I did a high school chemistry product where I made different soaps with different kinds of salts and fats.
Ah, interesting. I really am interested in this kind of stuff, I do a lot of research already but you can never know enough :D
I guess I'll simply drop some of these hard restrictions then. I'm also happy to say that burnt lime is already in the new version, so I can use that. And seashells you say? It seems so; but I can't find any evidence that it was used in the Middle Ages - keep in mind that not everything was known then, even though it could have been done. People didn't know chemistry nor systematical experimentation (with a few exceptions), they were mostly just working based on experience.
But yeah, if you have more such suggestions, keep them coming - I'm still knee-deep in designing tradegoods (there are A LOT now), so I can still easily incorporate any changes, like burnt lime for soap now.
A last suggestion, pick up the validator, because you have a lot of unnecessary ANDs; the default of any scope is an AND (validator told me this!), so I guess it is only really needed if you are within an OR.
I am aware of these, they clutter up the validator every time I load it :mad:. But I'm afraid they need to stay, because really I am not that good at coding, and I tend to forget logical connections immediately unless they are spelled out completely every time. So these are only there to remind me what the code is supposed to say, and I'll keep them :)
 
I am aware of these, they clutter up the validator every time I load it :mad:. But I'm afraid they need to stay, because really I am not that good at coding, and I tend to forget logical connections immediately unless they are spelled out completely every time. So these are only there to remind me what the code is supposed to say, and I'll keep them :)

Let me tell you the story of code-granddaddy PREVPREVPREVPREV....
 
Let me tell you the story of code-granddaddy PREVPREVPREVPREV....
:D
Well I still use PREVPREV in scripted triggers, but that's about it. But really event_targets almost feel like having hard discs instead of punchcards ;)

Btw, new dev diary is postponed, some design changes I just though of...
 
2nd Dev Diary
Welcome to the second dev diary! It's called
"Going that extra mile"

Since I am busy with real-life stuff currently, I didn't have time to integrate resources back in to the mod, about which I wanted to talk. But I think I can share something else, which will be useful and necessary to understand when you want to play with the mod later on. So for the next few diaries we'll dive a bit "behind the scenes" and see how the mod will work now. I'll explain fundamental ideas and concepts, and show a bit of code. Hope it won't be too boring ^^

Trade Range
As you know, the old mod version also had "trade ranges" that differ depending on the tradegood. The idea is that this value represents how far away a good a) could and b) would be traded in the Middle Ages. I assign the values based on my own research and my own discretion, because it is an abstract concept and there are no actual real-world restrictions on distances for trade. But I check a few things when deciding traderange, and these are:

1. "Shelf Life"
Some goods tend to spoil fast, especially if you consider that in medieval times there was no refrigeration or canning technology. If you take milk for example: Today, you can import fresh milk from the Alps all the way up to Scandinavia, or even into the USA (if that is sensible is another question altogether). But in the Middle Ages, without refrigeration milk would have spoilt after a few days, and even transporting it from say Berlin to Munich would have been impossible without it spoiling. That's why people invented cheese (probably): Cheese stays fresh for a long time, and you can even transport it to other cities. That's also why the Hansa (and people in general) needed INSANE amounts of salt for salting herrings or meat. Salted meat/fish stays fresh for a long time, and this need for salt for preservation was a major factor contributing to the demand for salt, which eventually lead to it being called the "white gold".
So in the game, "Milk" and "Raw Fish" will have a very short trade range, while "Cheese" and "Preserved Meat" will have a longer one.

2. Value
There is a reason the Silk Road is called Silk Road: Silk is a fabric that is sought after everywhere, expensive and lightweight. It could easily be transported in rather small quantities and still be worth the trip for the merchants, in contrast to e.g. salt which would only be profitable as a bulk good (as contrary to some common myths, salt was not worth its weight in gold). So "Silk" as a tradegood would have an even larger traderange than say "Cheese".*

3. Weight
As said above, silk is both valuable and lightweight. Now take gold for example: It is also valuable, and was transported around a lot both in the form of coins and in the metal itself (you might not know, but especially in the early Middle Ages it was common to pay in "weight" of gold, because local people in Scotland wouldn't know the exact value of a Byzantine coin, nor that of an Arabic or the other hundreds different coins that got minted). But gold is seldomly found as perfect nuggets, and the "Gold Ore" tradegood that represents the form gold is found means a big chunk of stone with a little bit of gold in it. Now theoretically this is also valuable already, as the gold is in there. But if a merchant were to buy that rock and sell it a few hundred kilometers away, he'd have to transport the entire rock all the way, which would significantly boost his transportation costs and possibly make the thing unprofitable. It really comes down to common sense, so "Gold Ore" will have a traderange comparable to "Milk", even though it does not spoil: Because transporting it far away simply is stupid - it'll have to be smelted to "Gold" near the mine.

That being said, here are some pictures to illustrate how far different traderanges are on the map:
50 Range Münster-Jülich.jpg 100 Range Münster-Hamburg.jpg 200 Range Münster-Middlesex.jpg 400 Range Münster-Rome.jpg 800 Range Münster-Marrakech.jpg 1600 Range Münster-Dhofar.jpg
All take Münster as the arbitrary starting point, and are increasing in size: Minimal (<50), Short (<100), Normal (<200), Long (<400), Very Long (<800), Extreme (<1600).

Traderange will actually increase over the course of the game, based on a few different things:

1. Technology
New ideas and concepts regarding trade were developed during the Middle Ages, including but not limited to the Double-entry bookkeeping system. This technological progress allowed the economy and especialyl trade to grow quite a bit, laying the groundwork for the later developments (which tend to incorrectly be attributed only to the Renaissance and EU4's timeframe). Therefore, traderange will increase by 5% for every step of "Trade Practices" technology the importing province has. So a Venice with high trading tech can import things from further away than say a tribe in Scandinavia.

2. "Trade Fair" Modifier
There are some new concepts in the mod about which we'll talk about at later point. For now you should know that there is a possible "Trade Fair" modifier which certain provinces can have, that boosts income a bit and also gives an additional one-time 5% increase to that province's traderange (meaning products it wants to import can be further away than usually possible).

Thus, the total traderange for "short" at Trade Practices 8 and with a Trade Fair would be 145 instead of 100 - a potential 45% increase! Another reason to invest into Trade Practices, even as a feudal ruler...


Well, that's it for today!
Why traderange is now more important than ever, and how exactly tradegoods are imported we'll talk about in a later dev diary. As a bonus, here is a sniplet of code that shows how the traderange triggers look (it actually hasn't changed much since V1, but I guess few people comb through the files):
code sniplet traderange.jpg


And in case you missed it: Here is the link to the last dev diary



*click! - Nice smile!
 
Last edited:
Does CK2 support recursive triggers? If so, then the range access trigger could look for a trade post (not blocked by war and within a certain distance) with access. So it will continue on only if trade post are active and running.

something like:

recursive_trigger = {
OR = {
AND...
AND...
any_province = {
#some distance check(s)
lies_on_trade_route_trigger = yes # or check that they both are on the same specific trade route
has_trade_post = yes
# make sure it isn't blocked, which according to the wiki requires it to be not occupied, I don't know how to set that exactly
recursive_trigger = yes
}
}
}

It should keep looking until it one of two things happen:
a. it finds a province that satisfies one of the many ORs
b. its has gone through all the trade route provinces in distance from another trade route province, that aren't blocked, and none of them have access.

This could be useful for things like gold or gems that practically last forever, allowing them to be traded across the entire map, while still making them a variable quantity through war and access to traders (in the form of trade posts).
 
Yep, I already use recursive events for all my "maintenance" events that fire for each province on a regular basis. Not sure about recursive triggers, but since you can call scripted triggers inside scripted triggers, I assume you can, too.

Does CK2 support recursive triggers? If so, then the range access trigger could look for a trade post (not blocked by war and within a certain distance) with access. So it will continue on only if trade post are active and running.

something like:

recursive_trigger = {
OR = {
AND...
AND...
any_province = {
#some distance check(s)
lies_on_trade_route_trigger = yes # or check that they both are on the same specific trade route
has_trade_post = yes
# make sure it isn't blocked, which according to the wiki requires it to be not occupied, I don't know how to set that exactly
recursive_trigger = yes
}
}
}

It should keep looking until it one of two things happen:
a. it finds a province that satisfies one of the many ORs
b. its has gone through all the trade route provinces in distance from another trade route province, that aren't blocked, and none of them have access.

This could be useful for things like gold or gems that practically last forever, allowing them to be traded across the entire map, while still making them a variable quantity through war and access to traders (in the form of trade posts).
Yep that's a good idea that also had occurred to me. However, I decided to stay with one arbitrary distance that doesn't need tradeposts.
First, war blocking off trade entirely is neither very realistic nor desirable gameplay-wise - even vanilla will be changing that in the next patch. And for reasons I don't really want to talk about yet, it is imperative that tradegoods are accessible and readily dispersed through the map at all times.
About valuable tradegoods being around indefinitely, that is probably realistic, but for a few reasons (one of them the shrouded mystery again) this is not feasible. One of them is that I am always concerned about visibility: How can the player easily, at a glance see what is going on? A tradegood that is traded around the entire map would spam province modifiers with say "Gems". But how can the player tell whether the gems originated there or were only traded there? I could of course make different tradegoods ("Raw Gems" & "Traded Gems") for them, but that would increase my already now huge amount of resources.
This might all sound a bit confusing because I am omitting important reasons just to tease you, but bottom line is a tradegood can only be traded within its traderange, and that effective range can only increase if it is made into a refined/finalized good, for example "Gems" into "Jewelry". And let me assure you, even finalized goods aren't as much of a dead end anymore... ;)

Well, alas these things are only in my head for now, and coding will take time. But keep the suggestions coming if you want, cause even though I may discard some they are still potentially helpful :)
On a side note, I just thought that with traderange being dynamical, there should probably be a fake mapmode that displays it. I am thinking a province decision that displays the traderange for that specific province... we'll see.
 
The trade posts being blocked wouldn't stop all trade, just those that are FAR off, all the neighbor and trade practice distanced provinces' goods would still be available. Probably only really useful for things like silk from the far east, Damascus steel, or polish cochineals (carmine dyes); somethings that were rather location specific, which is probably not the direction you are going.

So, at the very least, you could use recursive events to check triggers, and simulate a recursive trigger, even if you can't actually code them?
That sounds so painful and tedious, I have to try it!
 
Nice, not that many people I know know about Polish cochineals - I see your input will be valuable once I get to revealing the new tradegood lineup :D
But yeah, in that case it would be too specific to justify the performance footprint. The mod has enough expensive checks as it is ^^