Topic: Game Initialization
kaputtnik |
Posted at: 2021-04-18, 19:07
Lost in the djungle of init.lua-files Writing scenarios (campaigns) is so troublesome... i am writing one for years now. From time to time i find some motivation to work further but after some time the motivation get lost again, just because it's so annoying to start the scenario from the beginning, find a failure, fix it, start the scenario again from the beginning, find the next failure, start again, check possible playeractions, find a failure again, fix it, and so on, and so on... Top Quote |
Atanase Topic Opener |
Posted at: 2021-04-18, 20:40
Do you know the motto of Charles de Valois-Bourgogne, taken over by Guillaume d'Orange-Nassau? There is no need to hope in order to undertake nor to succeed in order to persevere. I agree. La connaissance ne vaut que si elle est partagée par le plus grand nombre. |
Atanase Topic Opener |
Posted at: 2021-04-20, 12:12
Hello, It is not always easy to persevere. The initialization of Economy work very well. La connaissance ne vaut que si elle est partagée par le plus grand nombre. |
Nordfriese |
Posted at: 2021-04-20, 12:22
I would guess you do it in the wrong order. When you connect two previously separate economies, each target setting can become either the first economy's target or the second economy's target. This is resolved by picking the target value which was least recently modified. If they were both modified at the same time, choice is arbitrary (but deterministic). So it seems there may be a problem with too-early or too-late setting of the target amounts. Edit: If this does not help, please post the code with which the problem can be reproduced Edited: 2021-04-20, 12:25
Top Quote |
Atanase Topic Opener |
Posted at: 2021-04-20, 14:11
But... When is the 'Default' economy initialized? My initialization is made in file 'starting_conditions.lua' which is the first local include in 'init.lua'. I open the economy window, it is as I want it and the name is "-", I click to build a metal workshop, still good, I click on the flag of my headquarter to create the road and just then I see the economy go to 'default' . To initialize I am using the syntax given by kaputtnik above. Just hq is global variable, not local. Actually there is a lot of dust in my files. The .tar.bz2 is 1 Mo big. But if you want I can post it. La connaissance ne vaut que si elle est partagée par le plus grand nombre. |
Nordfriese |
Posted at: 2021-04-20, 14:22
The "Default" profile is not stored in the Top Quote |
Atanase Topic Opener |
Posted at: 2021-04-20, 15:19
It seemed to me that the 'Default' profile was not stored, I had looked at the file in question and had not found it, but when nothing else works we leave it to chance. Enclose Atanase.zip I had to try : .tar.bz2 and .tar.gz before to find that only .zip is allowed. Edited: 2021-04-20, 15:20
La connaissance ne vaut que si elle est partagée par le plus grand nombre. |
Nordfriese |
Posted at: 2021-04-20, 15:37
Okay, the reason for the strange behaviour results from the fact that your code is run outside of a coroutine. This is a bit non-standard so it may have bugs that do not occur otherwise. This way, all modifications happen at gametime 0 which is also the constant used to mark that a setting was never modified and can therefore be safely overwritten.
then it works fine. Top Quote |
Atanase Topic Opener |
Posted at: 2021-04-20, 16:56
Ok, thank you, it seems good now. Until next time..... I said you that I'm a real hunting dog to find problems that no one has ever seen. La connaissance ne vaut que si elle est partagée par le plus grand nombre. |
Atanase Topic Opener |
Posted at: 2021-04-20, 17:30
You won't end up hating me. The economy remained as I wanted, perfect. The blacksmith made the three items I asked for (hammer, pick, felling ax) Now he is at 0% activity while he still has enough in the forge to make 4 tools. The purpose of all this is Let's be Eco-friendly and avoid making 25 kitchen tools when we only have 3 big inns and only need 9 kitchen tools. A true hound I said. La connaissance ne vaut que si elle est partagée par le plus grand nombre. |